-
Notifications
You must be signed in to change notification settings - Fork 3
/
aglc2.bbx
404 lines (360 loc) · 11.3 KB
/
aglc2.bbx
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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
% AGLC2 citation style for Biblatex
% This file was created by editing the standard biblatex style
\ProvidesFile{aglc2.bbx}
% AGLC likes to use single quotes everywhere, not double quotes.
\renewrobustcmd{\mkbibquote}[1]{`#1'}
\DeclareFieldFormat{pages}{#1}
\DeclareFieldFormat{shorttitle}{{\em #1}}
\DeclareFieldFormat{encyclopaediatitle}{{\em #1}}
\DeclareFieldFormat{postnote}{#1}
\renewcommand*{\finalnamedelim}{%
\ifnum\value{liststop}>2 \fi
\addspace\bibstring{and}\space}
\DeclareBibliographyDriver{shorthands}{%
\usedriver
{\DeclareNameAlias{sortname}{default}}
{\thefield{entrytype}}%
}
\DeclareBibliographyDriver{cite}{%
\usebibmacro{bibindex}%
\printnames[default]{author}%
\setunit{\addcomma\space}\newblock
\usebibmacro{title}%
\setunit{\space}\newblock
\usebibmacro{journal+issuetitle}%
%\iffieldundef{pages}{}
%{\printfield{pages}%
%\setunit{\space}\newblock}
\printfield{note}%
\setunit{\addcomma}\newblock
%\usebibmacro{pageref}%
}
% CASES
% Just simple for the moment, citation is provided in "notes" and regurgitated here.
\DeclareBibliographyDriver{jurisdiction}{%
\usebibmacro{bibindex}%
\iffieldundef{addendum}{}{\printfield{addendum}\setunit{\addcomma\space}\newblock}%
\usebibmacro{title}%
\setunit{\space}\newblock
\printfield{note}%
%\setunit{\addcomma}\newblock
%\usebibmacro{pageref}%
\iffieldundef{postnote}{}{\nopunct}%
}
\DeclareBibliographyDriver{short:jurisdiction}{%
\usebibmacro{bibindex}%
\iffieldundef{addendum}{}{\printfield{addendum}\setunit{\addcoma}\newblock}%
\usebibmacro{shorthand-or-title}%
\printfield{note}%
%\setunit{\addcomma}\newblock
%\usebibmacro{pageref}%
\iffieldundef{postnote}{}{\nopunct}%
}
% LEGISLATION
\DeclareBibliographyDriver{legislation}{%
\usebibmacro{bibindex}%
\usebibmacro{title+year}%
%\setunit{\space}\newblock%
%{\it \printfield{year}}%
\iffieldundef{note}{}%
{\addnbspace%
(\thefield{note})}\iffieldundef{postnote}{}{\nopunct}%
}
\DeclareBibliographyAlias{short:legislation}{legislation}
% TREATIES
% TODO: Cleanup use of spaces, blocks and commas!
% TODO: "entered into force" block should appear after the pinpoint.
\DeclareBibliographyDriver{legal}{%
\usebibmacro{bibindex}%
\usebibmacro{title},
%\setunit{\addcomma\space}
opened for signature \thefield{day}\setunit{\space}\printfield{month} \printfield{year}
\setunit{\addcomma\space}\newblock%
\iflistundef{organization}{}{%
\printlist[endash]{organization}%
\setunit{\addcomma\space}\newblock}%
\iffieldundef{series}{}{%
\printfield{series}%
\setunit{\addcomma\space}\newblock}%
\iffieldundef{note}{}%
{ (entered into force \thefield{note})}%
%\setunit{\addcomma}\newblock
%\usebibmacro{pageref}%
}
\DeclareBibliographyAlias{short:legal}{legal}
% Custom field. This will print the publisher field in plain text,
% then the title field is printed in italics and, following, the note field
% is printed in plain text. This is meant as a catch-all entry type for
% stuff such as encyclopaedias and UN documents that do not have a correspondig
% BibTeX type
\DeclareBibliographyDriver{manual}{%
\usebibmacro{bibindex}%
\usebibmacro{author/editor}%
\setunit{\addcomma\space}%
\usebibmacro{title}\addnbspace%
\setunit{\addcomma\space}%
\iffieldundef{note}{}{\thefield{note}\setunit{\addcomma\space}}%
}
% ARTICLE (journal article, newspaper article)
\DeclareBibliographyDriver{article}{%
\usebibmacro{bibindex}%
\usebibmacro{author/editor:lastnamefirst}%
\setunit{\addcomma\space}\newblock
\usebibmacro{title}%
\setunit{\space}\newblock
\usebibmacro{journal+issuetitle}%
\setunit{\space}\newblock
\printfield{pages}%
\setunit{\space}\newblock
%\printfield{note}%
%\setunit{\space}\newblock
%\setunit{\addcomma}\newblock
%\usebibmacro{pageref}%
\usebibmacro{online}%
}
\DeclareBibliographyAlias{short:article}{article}
\DeclareBibliographyDriver{book}{%
\usebibmacro{bibindex}%
\usebibmacro{author/editor:lastnamefirst}%
\setunit{\addcomma\space}\newblock%
\usebibmacro{maintitle+title}%
\setunit{\addspace}\newblock%
%\iffieldundef{url}{\printfield{note}\newunit\newblock}{}%
\usebibmacro{edition+year}%
\newunit\newblock%
\usebibmacro{origtitle}%
\newunit\newblock%
% For some reason I need to insert a space only in the book driver's postnote
% I don't have to do this in the case,legislation or report drivers
% as of 3 Oct 2016 I haven't used any other drivers with
% this new code.
\iffieldundef{postnote}{}{\space\nopunct}%
}
\DeclareBibliographyAlias{short:book}{book}
\DeclareBibliographyDriver{incollection}{%
\usebibmacro{bibindex}%
\usebibmacro{author/editor:lastnamefirst}%
\setunit{\addcomma\space}\newblock
\usebibmacro{maintitle+title}%
\setunit{\space}\newblock
\usebibmacro{in:}%
\setunit{\space}\newblock
\usebibmacro{editor}%
\setunit{\space}\newblock
\usebibmacro{maintitle+booktitle}%
\setunit{\space}
\printfield{note}%
\newunit\newblock
\usebibmacro{edition+year}%
\newunit\newblock
\iffieldundef{postnote}{}{\nopunct}
}
\DeclareBibliographyAlias{short:incollection}{incollection}
%%% Webpage. Use the online driver. Website and Url don't seem to work
%%% and I don't know enough LaTeX to fix it.
\DeclareBibliographyDriver{online}{%
\usebibmacro{bibindex}%
\usebibmacro{author/editor:lastnamefirst}%
\setunit{\addcomma\space}\newblock
\usebibmacro{title}%
\setunit{\space}\newblock
\usebibmacro{urldate}%
\setunit{\space}\newblock
\usebibmacro{online}%
}
\DeclareBibliographyAlias{short:online}{online}
%%% Report bibliography driver.
%%% Created by Mark Ferraretto 30 Sep 2016
%%% Using these fields from AGLC
%%% Author : Reporting body (eg: ALRC)
%%% Title : Title of the report
%%% Note : 'Report', 'Interim Report', 'Discussion Paper'
%%% Pages : Report number
%%% Year : Year of report
\DeclareBibliographyDriver{report}{%
\usebibmacro{bibindex}%
\usebibmacro{author/editor}%
\setunit{\addcomma\space}\newblock
\usebibmacro{title}%
\setunit{\addcomma\space}\newblock
\printfield{note} No \printfield{pages}%
\setunit{\space}\newblock
\printfield[parens]{year}%
\iffieldundef{postnote}{}{\nopunct}%
}
\DeclareBibliographyAlias{short:report}{report}
%\renewbibmacro*{in:}{%
% \bibstring{in}%
% \setunit{\space}}
\newbibmacro*{online}{%
\iffieldundef{url}{}{\iffieldundef{note}{}{\printfield{note}\setunit{\space}}\printfield{url}}%
}
\renewbibmacro*{author}{%
\ifuseauthor
{\printnames{author}}
{}}
\renewbibmacro*{editor}{%
\ifthenelse{\ifuseeditor\AND\NOT\ifnameundef{editor}}%
{\printnames[][1-3]{editor}%\addspace%
\usebibmacro{editorstrg}%
\clearname{editor}}%
{}}
%\newbibmacro*{maintitle+title}{%
% \iffieldundef{maintitle}
% {}
% {\usebibmacro{maintitle}%
% \newunit\newblock
% \iffieldundef{volume}
% {}
% {\printfield{volume}%
% \printfield{part}%
% \setunit{\space}}}%
% \usebibmacro{title}%
% \newunit}
\newbibmacro*{maintitle+title}{%
\iffieldundef{title}
{\usebibmacro{booktitle}}%
{\usebibmacro{title}}%
\newunit}
\newbibmacro*{maintitle+booktitle}{%
\iffieldundef{maintitle}
{}
{\usebibmacro{maintitle}%
\newunit\newblock
\iffieldundef{volume}
{}
{\printfield{volume}%
\printfield{part}%
\setunit{\space}}}%
\usebibmacro{booktitle}%
\newunit}
\newbibmacro*{journal+issuetitle}{%
\usebibmacro{parensyear}%
%\iffieldundef{volume}{\iffieldundef{number}{}{\setunit*{\addspace}}}{\setunit*{\addspace}}%
\printfield{volume}%
\iffieldundef{volume}{\printfield{number}}{\printfield[parens]{number}}%
%\printfield{eid}%
\iffieldundef{volume}{\iffieldundef{number}{}{\setunit{\space}\newblock}}{\setunit{\space}\newblock}%
%\setunit{\space}\newblock
%\newunit\newblock
%\usebibmacro{issue}%
\usebibmacro{journal}%
%\setunit{\space}\newblock
}
% Italic title and year for legislation, not italic for bills
\newbibmacro*{title+year}{%
\setunit{\addspace}%
\ifthenelse{\equal{\thefield{entrysubtype}}{bill}}
{\thefield{title}\addspace\thefield{year}}%
{\ifthenelse{\equal{\thefield{entrysubtype}}{explanatory}}
{Explanatory Memorandum, \thefield{title}\addspace\thefield{year}}%
{{\it \thefield{title}\addspace\thefield{year}}}}%
\newunit}
% Encyclopaedia title in Italics
\newbibmacro*{encyclopaediatitle}{
\setunit{\addspace}%
{\it \thefield{encyclopaediatitle}}%
}
\newbibmacro*{title+issuetitle}{%
\usebibmacro{periodical}%
\setunit*{\addspace}%
\iffieldundef{series}
{}
{\newunit
\printfield{series}%
\setunit{\addspace}}%
\printfield{volume}%
\setunit*{\space}%
\printfield{number}%
\setunit{\space}%
\printfield{eid}%
\setunit{\addspace}%
\usebibmacro{issue+date}%
\newunit\newblock
\usebibmacro{issue}%
\newunit}
\newbibmacro*{issue+date}{%
\iffieldundef{year}{}
{\printtext[parens]{%
\iffieldundef{issue}
{\iffieldundef{month}
{\printfield{year}}
{\iffieldundef{day}
{\printfield{month}%
\setunit{\addspace}%
\printfield{year}}
{\printtext{\bibdate}}}}
{\printfield{issue}%
\setunit{\addspace}%
\printfield{year}}}}%
\newunit}
\newbibmacro*{urldate}{%
\iffieldundef{urlyear}{}
{\printtext[parens]{%
\iffieldundef{urlmonth}
{\printfield[year]{urlyear}}
{\iffieldundef{urlday}
{\printfield[month]{urlmonth}\setunit{\addspace}\printfield[year]{urlyear}}
{\printfield[day]{urlday}\setunit{\addspace}\printfield[month]{urlmonth}\setunit{\addspace}\printfield[year]{urlyear}}%
}%
}%
}%
\newunit%
}
% If a year is given, show it in brackets,
% otherwise, add a comma.
% Use square brackets if there is no volume.
\newbibmacro*{parensyear}{%
\iffieldundef{year}
{\setunit{\addcomma\space}\newblock}%
{\iffieldundef{volume}{\printfield[brackets]{year}}{\printfield[parens]{year}}%
\setunit*{\addspace}}}
%\newunit}}
\newbibmacro*{series+number}{%
\printfield{series}%
\setunit*{\addspace}%
\printfield{number}%
\newunit}
\newbibmacro*{edition+year}{%
\addspace(\setunit{}%
\ifnameundef{translator}{}{\printnames{translator} trans\addcomma\addspace}%
\iffieldundef{note}{}{first published \printfield{note}\addcomma\addspace}%
\iffieldundef{edition}
{\printlist{publisher}\setunit{\addcomma\addspace}\printfield{year}}%
{\printlist{publisher}\setunit{\addcomma\addspace}\printfield{edition}\setunit{\addcomma\addspace}\printfield{year}}%
)}
\newbibmacro*{origtitle}{%
\iffieldundef{origtitle}{}{\addspace\setunit{}\mkbibbrackets{trans of: {\it \printfield{origtitle}}}}%
}
\newbibmacro*{publisher+location+year}{%
\printlist{location}%
\iflistundef{publisher}
{\setunit*{\addspace}}
{\setunit*{\space}}%
\printlist{publisher}%
%\setunit*{\space}%
\setunit{\addcomma\addspace}%
\printfield{edition}%
\setunit{\addcomma\addspace}%
\printfield{year}%
\newunit}
\newbibmacro*{institution+location+year}{%
\printlist{location}%
\iflistundef{institution}
{\setunit*{\addspace}}
{\setunit*{\space}}%
\printlist{institution}%
\setunit*{\space}%
\printfield{year}%
\newunit}
\newbibmacro*{location+year}{%
\printlist{location}%
\setunit*{\addspace}%
\printfield{year}%
\newunit}
\newbibmacro*{chapter+pages}{%
\printfield{chapter}%
\setunit*{\space}%
\printfield{pages}%
\newunit}
\endinput