aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2021-07-20 02:20:48 +0200
committerJohn Ankarström <john@ankarstrom.se>2021-07-20 02:20:48 +0200
commit750b1c9febf27760e70aa2ce49a7fd94121fd145 (patch)
tree02eeb9f8058902045a136b7c6f5a173d25350619
parent253264591e14d173ac256fcb0b83b3463548c8fc (diff)
downloadfref-750b1c9febf27760e70aa2ce49a7fd94121fd145.tar.gz
Print volume, pages; add internet address field (%ad)
-rw-r--r--example.t3
-rw-r--r--refs.lex39
2 files changed, 34 insertions, 8 deletions
diff --git a/example.t b/example.t
index 7b5ebbb..1cf8730 100644
--- a/example.t
+++ b/example.t
@@ -7,6 +7,8 @@ References
%ti Курс грамматики русского языка. Часть 1-ая: Фонетика
%ci Варшава
%pu Типография Михаила Земкевича
+%pp 110-123
+%ad http://www.example.com/b1887.pdf
.XP
%au de Courtenay, J. Baudouin
%au Author, Fake Extra
@@ -17,6 +19,7 @@ References
%tr Edward Stankiewicz
%ci Bloomington
%pu Indiana University Press
+%?? Extra information
.XP
%au Lesk, M. E.
%ti Some Applications of Inverted Indexes on the UNIX System
diff --git a/refs.lex b/refs.lex
index 02ebbb0..b78fa4b 100644
--- a/refs.lex
+++ b/refs.lex
@@ -4,8 +4,11 @@
#define MAX 255
#define AND "och"
+ #define AVAIL "Tillgänglig: "
#define ED "red."
+ #define PP "ss."
#define TR "Övers."
+ #define VOL "vol."
void field(char *);
void entry(void);
@@ -16,16 +19,17 @@
struct entry {
int a; /* Number of authors. */
char au[MAX][MAX];
+ char ad[MAX];
char al[MAX];
char bo[MAX];
char ci[MAX];
char da[MAX];
char ed[MAX];
char jo[MAX];
- char no[MAX];
- char pg[MAX];
+ char no[MAX]; /* TODO */
+ char pp[MAX];
char pu[MAX];
- char se[MAX];
+ char se[MAX]; /* TODO */
char ti[MAX];
char tr[MAX];
char vo[MAX];
@@ -58,6 +62,7 @@ field(char *t)
t[strcspn(t, "\n")] = 0;
AS("au",e.au[e.a++]);
+ AS("ad",e.ad);
AS("al",e.al);
AS("bo",e.bo);
AS("ci",e.ci);
@@ -65,7 +70,7 @@ field(char *t)
AS("ed",e.ed);
AS("jo",e.jo);
AS("no",e.no);
- AS("pg",e.pg);
+ AS("pp",e.pp);
AS("pu",e.pu);
AS("se",e.se);
AS("ti",e.ti);
@@ -93,20 +98,38 @@ entry()
if(i == e.a-1)
printf("%s", e.au[i]);
+ /* Print date. */
(pf(" (%).\n", e.da) || (e.a ? pf(".\n") : 0));
- if (*e.bo || *e.jo){
+
+ /* Print title, book/journal. */
+ if(*e.bo || *e.jo){
pf("%.\n", e.ti);
pf("\\fI%\\fP", EI(e.bo, e.jo));
pf(" ("ED" %)", e.ed);
- pf(".\n");
}else
- pf("\\fI%\\fP.\n", e.ti);
+ pf("\\fI%\\fP", e.ti);
+
+ /* Print volume, pages. */
+ pf(", "VOL" %", e.vo);
+ pf(", "PP" %", e.pp);
+ pf(".\n");
+
+ /* Print translator. */
pf(TR" %.\n", e.tr);
+
+ /* Print city, publisher. */
(pf("%: %.\n", e.ci, e.pu) || pf("%.\n", e.pu));
+ /* Print other information. */
+ pf("%.\n", e.QQ);
+
+ /* Print internet address. */
+ pf(AVAIL"%\n", e.ad);
+
#define CL(a) *a = 0
e.a = 0;
+ CL(e.ad);
CL(e.al);
CL(e.bo);
CL(e.ci);
@@ -114,7 +137,7 @@ entry()
CL(e.ed);
CL(e.jo);
CL(e.no);
- CL(e.pg);
+ CL(e.pp);
CL(e.pu);
CL(e.se);
CL(e.ti);