publ-imp-chicago.lua /size: 12 Kb    last modification: 2020-07-01 14:35
1local specification = {
2    --
3    -- metadata
4    --
5    name      = "chicago",
6    version   = "1.00",
7    comment   = "Chicago Manual of Style specification",
8    author    = "Alan Braslau and Hans Hagen",
9    copyright = "ConTeXt development team",
10    --
11    -- derived (combinations of) fields (all share the same default set)
12    --
13    virtual = {
14        "authoryear",
15        "authoryears",
16        "authornum",
17        "num",
18        "suffix",
19    },
20    --
21    -- special datatypes
22    --
23    types = {
24        --
25        -- list of fields that are interpreted as names: "NAME [and NAME]" where
26        -- NAME is one of the following:
27        --
28        -- First vons Last
29        -- vons Last, First
30        -- vons Last, Jrs, First
31        -- Vons, Last, Jrs, First
32        --
33        author      = "author", -- interpreted as name(s)
34        withauthor  = "author",
35        editor      = "author",
36        translator  = "author",
37        artist      = "author",
38        composer    = "author",
39        producer    = "author",
40        director    = "author",
41        doi         = "url",        -- an external link
42        url         = "url",
43        page        = "pagenumber", -- number or range: f--t
44        pages       = "pagenumber",
45        volume      = "range",
46        number      = "range",
47        keywords    = "keyword",    -- comma|-|separated list
48        year        = "number",
49    },
50    --
51    -- categories with their specific fields
52    --
53    categories = {
54        --
55        -- categories are added below
56        --
57    },
58}
59
60local generic = {
61    --
62    -- A set returns the first field (in order of position below) that is found
63    -- present in an entry. A set having the same name as a field conditionally
64    -- allows the substitution of an alternate field.
65    --
66    -- note that anything can get assigned a doi or be available online.
67    doi        = { "doi", "url" },
68    editionset = { "edition", "volume", "number", "pages" },
69}
70
71-- Definition of recognized categories and the fields that they contain.
72-- Required fields should be present; optional fields may also be rendered;
73-- all other fields will be ignored.
74
75-- Sets contain either/or in order of precedence.
76--
77-- For a category *not* defined here yet present in the dataset, *all* fields
78-- are taken as optional. This allows for flexibility in the addition of new
79-- categories.
80
81local categories = specification.categories
82
83-- an article from a journal
84
85categories.article = {
86    sets = {
87        author = { "author", "organization", "editor", "title" },
88        doi    = generic.doi,
89    },
90    required = {
91        "author", -- a set
92    },
93    optional = {
94        "withauthor", "translator",
95        "year",
96        "subtitle", "type", "file",
97        "journal", "volume", "number", "pages",
98        "doi", "note",
99     -- APA ignores this: 
100     -- 
101     -- "month",
102     -- 
103     -- fields defined in jabref but presently ignored:
104     -- 
105     -- "issn",
106    },
107}
108
109-- an article from a magazine
110
111categories.magazine = {
112    sets = categories.article.sets,
113    required = {
114        "author",
115        "year",
116        "journal",
117    },
118    optional = {
119        "withauthor", "translator",
120        "subtitle", "type", "file",
121        "number",
122        "month", "day",
123        "doi", "note",
124    },
125}
126
127categories.newspaper = categories.magazine
128
129-- (from jabref) to be identified and setup ...
130
131categories.periodical = {
132    sets = {
133        author = { "editor", "publisher", "organization", },
134        doi    = generic.doi,
135    },
136    required = {
137        "title",
138        "year",
139    },
140    optional = {
141        "author", "withauthor", "translator",
142        "subtitle", "file",
143        "series", "volume", "number", "month",
144        "organization",
145        "doi", "note",
146    },
147}
148
149-- (from jabref) to be identified and setup ...
150
151categories.standard = {
152    sets = {
153        author = { "author", "institution", "organization" },
154        doi    = generic.doi,
155    },
156    required = {
157        "author",
158        "year",
159        "title", "subtitle",
160        "doi", "note",
161    },
162    optional = {
163        "withauthor", "translator",
164    },
165}
166
167-- a book with an explicit publisher.
168
169categories.book = {
170    sets = {
171        author     = { "author", "editor", "publisher", "title" },
172        ineditor   = { "editor" },
173        editionset = generic.editionset,
174        doi        = generic.doi,
175    },
176    required = { "author" },
177    optional = {
178        "ineditor",
179        "withauthor", "translator",
180        "year", "month", "day",
181        "subtitle", "type",  "file",
182        "editionset", "series",
183        "address",
184        "doi", "note",
185        "abstract",
186    },
187}
188
189-- a part of a book, which may be a chapter (or section or whatever) and/or a range of pages.
190
191categories.inbook = {
192    sets = {
193        author     = { "author", "organization", "editor", "publisher", "title", },
194        ineditor   = { "editor" },
195        editionset = generic.editionset,
196        doi        = generic.doi,
197    },
198    required = {
199        "author",
200        "year" ,
201    },
202    optional = {
203        "ineditor",
204        "withauthor", "translator",
205        "subtitle", "type", "file",
206        "booktitle", "subbooktitle",
207        -- APA ignores this: "chapter",
208        "editionset", "series",
209        "month",
210        "address",
211        "doi", "note",
212    },
213}
214
215-- a book having its own title as part of a collection.
216-- (like inbook, but we here make booktitle required)
217
218categories.incollection = {
219    sets = {
220        author     = { "author", "editor", "publisher", "title", },
221        ineditor   = { "editor" },
222        editionset = generic.editionset,
223        doi        = generic.doi,
224    },
225    required = {
226        "author",
227        "booktitle",
228        "year",
229    },
230    optional = {
231        "ineditor",
232        "withauthor", "translator",
233        "subtitle", "type", "file",
234        "subbooktitle",
235        "editionset", "series",
236        -- APA ignores this: "chapter",
237        "month",
238        "address",
239        "doi", "note",
240    },
241}
242
243-- a work that is printed and bound, but without a named publisher or sponsoring institution.
244
245categories.booklet = {
246    sets = {
247        author = { "author", "title", },
248        publisher = { "howpublished" }, -- no "publisher"!
249        doi    = generic.doi,
250    },
251    required = {
252        "author"
253    },
254    optional = {
255        "withauthor", "translator",
256        "publisher",
257        "year", "month",
258        "subtitle", "type", "file",
259        "address",
260        "doi", "note",
261     },
262}
263
264-- the proceedings of a conference.
265
266categories.proceedings = {
267    sets = {
268        author     = { "editor", "organization", "publisher", "title" }, -- no "author"!
269        publisher  = { "publisher", "organization" },
270        editionset = generic.editionset,
271        doi        = generic.doi,
272    },
273    required = {
274        "author",
275        "year"
276    },
277    optional = {
278        "withauthor", "translator",
279        "publisher",
280        "subtitle", "file",
281        "editionset", "series",
282        "month",
283        "address",
284        "doi", "note",
285    },
286}
287
288-- an article in a conference proceedings.
289
290categories.inproceedings = {
291    sets     = categories.incollection.sets,
292    required = categories.incollection.required,
293    optional = {
294        "withauthor", "translator",
295        "subtitle", "type", "file",
296        "month",
297        "edition", "series",
298        "address", "organization",
299        "doi", "note",
300    },
301}
302
303categories.conference = categories.inproceedings
304
305-- a thesis (of course).
306
307categories.thesis = {
308    sets = {
309        doi = generic.doi,
310    },
311    required = {
312        "author",
313        "title",
314        "school",
315        "year",
316        "type"
317    },
318    optional = {
319        "withauthor", "translator",
320        "subtitle", "file",
321        "month",
322        "address",
323        "doi", "note",
324    },
325}
326
327categories.mastersthesis = {
328    sets     = categories.thesis.sets,
329    required = {
330        "author",
331        "title",
332        "school",
333        "year"
334    },
335    optional = {
336        "withauthor", "translator",
337        "type",
338        "subtitle", "file",
339        "month",
340        "address",
341        "doi", "note",
342    },
343}
344categories.phdthesis = categories.mastersthesis
345
346-- a report published by a school or other institution, usually numbered within a series.
347
348categories.techreport = {
349    sets = {
350        author     = { "author", "institution", "publisher", "title" },
351        publisher  = { "publisher", "institution", },
352        editionset = { "type", "volume", "number", "pages" }, -- no "edition"!
353        doi        = generic.doi,
354    },
355    required = {
356        "author",
357        "title",
358        "institution",
359        "year"
360    },
361    optional = {
362        "withauthor", "translator",
363        "publisher",
364        "address",
365        "subtitle", "file",
366        "editionset",
367        "month",
368        "doi", "note",
369    },
370}
371
372-- technical documentation.
373
374categories.manual = {
375    sets = {
376        author     = { "author", "organization", "publisher", "title" },
377        publisher  = { "publisher", "organization", },
378        editionset = generic.editionset,
379        doi        = generic.doi,
380    },
381    required = {
382        "title"
383    },
384    optional = {
385        "author", "publisher",
386        "withauthor", "translator",
387        "address",
388        "subtitle", "file",
389        "editionset", "month", "year",
390        "doi", "note",
391--         "abstract",
392    },
393}
394
395-- a patent (of course).
396
397categories.patent = {
398    sets = {
399        author = { "author", "assignee", },
400        publisher = { "publisher", "assignee", },
401        year = { "year", "yearfiled", },
402        month = { "month", "monthfiled", },
403        day = { "day", "dayfiled", },
404        doi = generic.doi,
405    },
406    required = {
407        "nationality",
408        "number",
409        "year",
410    },
411    optional = {
412        "type",
413        --check this: "language",
414        "author", "publisher",
415        "withauthor", "translator",
416        "title", "subtitle", "file",
417        "address",
418        "day", "month",
419        "doi", "note"
420    },
421}
422
423-- a document having an author and title, but not formally published.
424
425categories.unpublished = {
426    sets = {
427        doi = generic.doi,
428    },
429    required = {
430        "author",
431        "title",
432        "note"
433    },
434    optional = {
435        "withauthor", "translator",
436        "subtitle", "file",
437        "year", "month",
438        "doi"
439    },
440}
441
442-- like misc below but includes organization.
443
444categories.electronic = {
445    sets = {
446        doi = generic.doi,
447        author = { "author", "organization", },
448    },
449    required = {
450        "title"
451    },
452    optional = {
453        "subtitle", "type", "file",
454        "year", "month",
455        "author", "withauthor", "translator",
456        "address",
457        "organization",
458        "howpublished",
459        "doi", "note"
460    },
461}
462
463-- not bibtex categories...
464
465categories.film = {
466    sets = {
467        doi = generic.doi,
468        author = { "author", "producer", "director", },
469    },
470    required = {
471        "author",
472        "title",
473        "year",
474        "address", "publisher", -- aka studio
475    },
476    optional = {
477        "withauthor", "translator",
478        "type",
479        "note",
480        "doi",
481    },
482}
483
484categories.music = {
485    sets = {
486        doi = generic.doi,
487        author  = { "composer", "artist", "title", "album" },
488        title   = { "title", "album", },
489    },
490    required = {
491        "author",
492        "title",
493        "year",
494        "address", "publisher", -- aka label
495    },
496    optional = {
497        "withauthor", "translator",
498        "type",
499        "note",
500        "doi",
501    },
502}
503
504-- use this type when nothing else fits.
505
506categories.misc = {
507    sets = {
508        doi  = generic.doi,
509    },
510    required = {
511        -- nothing is really important here
512    },
513    optional = {
514        "author", "withauthor", "translator",
515        "title", "subtitle", "file",
516        "year", "month",
517        "howpublished",
518        "doi", "note",
519    },
520}
521
522-- other (whatever jabref does not know!)
523
524categories.other = {
525    sets = {
526        doi  = generic.doi,
527    },
528    required = {
529        "author",
530        "title",
531        "year"
532    },
533    optional = {
534        "withauthor", "translator",
535        "subtitle", "file",
536        "doi", "note",
537    },
538}
539
540-- if all else fails to match:
541
542categories.literal = {
543    sets = {
544        author = { "key" },
545        doi    = generic.doi,
546    },
547    required = {
548        "author",
549        "text"
550    },
551    optional = {
552        "withauthor", "translator",
553        "doi", "note"
554    },
555    virtual = false,
556}
557
558-- done
559
560return specification
561