blob: 33498d9e16737d6ccde0ea3dc015b900e64a9c01 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
|
%
% 8/4/'90
%Ciaran McHale
%Department of Computer Science, Trinity College, Dublin 2, Ireland.
%Telephone: +353-1-772941 ext 1538 FAX: +353-1-772204 Telex: 93782 TCD EI
%email: cjmchale@cs.tcd.ie or cjmchale%cs.tcd.ie@cunyvm.cuny.edu
% Hacked together by Ciaran McHale (cjmchale@cs.tcd.ie) to translate
% BibTeX bibliographies into refer format
% Based on a bib style file by Kannan Varadhan
%
ENTRY
{ % entry fields
abstract % non standard
address
annote % non standard
author
booktitle
chapter
edition
editor
howpublished
institution
journal
key
keywords % non standard
month
note
number
organization
pages
publisher
school
series
title
type
volume
year
}
{} % no integer entry variables
{ label extra.label sort.label } % label entry variables
STRINGS { s t a.name }
FUNCTION {not}
{ { #0 }
{ #1 }
if$
}
FUNCTION {and}
{ 'skip$
{ pop$ #0 }
if$
}
FUNCTION {or}
{ { pop$ #1 }
'skip$
if$
}
INTEGERS { nameptr namesleft numnames }
FUNCTION {handle.names}
{ 't := % type e.g. "A" for authors, "E" for editors
's := % the string containing the names
#1 'nameptr :=
s num.names$ 'numnames :=
numnames 'namesleft :=
{ namesleft #0 > }
{ s nameptr "{ff~}{vv~}{ll}{, jj}" format.name$ 'a.name :=
a.name "others" =
'skip$ % don't print out "%A others"
{ "%" t * " " * a.name * write$ newline$ }
if$
nameptr #1 + 'nameptr :=
namesleft #1 - 'namesleft :=
}
while$
}
FUNCTION {handle.maybe.empty}
{
't :=
duplicate$
empty$
'pop$
{ "%" t * " " * swap$ * write$ newline$ }
if$
}
FUNCTION {translate}
{
newline$ % get a blank line between each entry
title "T" handle.maybe.empty
booktitle "B" handle.maybe.empty
% there may be multiple authors so handle it differently
author empty$
{ " empty author in " cite$ * warning$ }
{ author "A" handle.names }
if$
editor "E" handle.maybe.empty
journal "J" handle.maybe.empty
keywords "K" handle.maybe.empty
cite$ "L" handle.maybe.empty
volume "V" handle.maybe.empty
abstract "X" handle.maybe.empty
% The date, if present may be just the year or both the month and year
% or might even be just the month
month empty$ year empty$ and
'skip$ % no date of publication so nothing to do
{
month empty$ % I'm using the if statement because I'm not
{ "" } % sure that--- month " " year * --- would work.
{ month " " * } % (The manual doesn't mention anything about
if$ % this so I'm playing safe)
year empty$
{ "" }
{ year }
if$
*
"D" handle.maybe.empty
}
if$
pages "P" handle.maybe.empty
note "O" handle.maybe.empty
number "N" handle.maybe.empty
series "S" handle.maybe.empty
annote "Y" handle.maybe.empty
address "C" handle.maybe.empty
}
FUNCTION {article} { translate }
FUNCTION {book} { translate }
FUNCTION {booklet} { translate }
FUNCTION {inbook} { translate }
FUNCTION {incollection} { translate }
FUNCTION {inproceedings} { translate }
FUNCTION {manual} { translate }
FUNCTION {mastersthesis} { translate }
FUNCTION {misc} { translate }
FUNCTION {phdthesis} { translate }
FUNCTION {proceedings} { translate }
FUNCTION {techreport} { translate }
FUNCTION {unpublished} { translate }
FUNCTION {default.type} { translate }
READ
ITERATE {call.type$}
|