diff options
Diffstat (limited to 'tex/context/base/publ-imp-apa.lua')
-rw-r--r-- | tex/context/base/publ-imp-apa.lua | 509 |
1 files changed, 352 insertions, 157 deletions
diff --git a/tex/context/base/publ-imp-apa.lua b/tex/context/base/publ-imp-apa.lua index f2625488e..3ee5a732e 100644 --- a/tex/context/base/publ-imp-apa.lua +++ b/tex/context/base/publ-imp-apa.lua @@ -1,207 +1,402 @@ --- category = { --- sets = { --- authors = { "author", "editor" }, --- }, --- required = { "authors", "title" }, --- optional = { "year", "journal", "editor", "volume", "number", "pages" }, --- virtual = { "authoryear", "authoryears", "authornum", "num", "suffix" }, --- } - --- category = { --- sets = { --- author = { "author", "editor" }, --- }, --- required = { "author", "title" }, --- optional = { "year", "journal", "editor", "volume", "number", "pages" }, --- virtual = { "authoryear", "authoryears", "authornum", "num", "suffix" }, --- } - -local article = { - required = { "authors" }, - optional = { "year", "subtitle", "type", "journal", "volume", "number", "pages", "note", "links", "file" }, - sets = { +local specification = { + -- + -- metadata + -- + name = "apa", + version = "1.00", + comment = "APA specification", + author = "Alan Braslau and Hans Hagen", + copyright = "ConTeXt development team", + -- + -- derived (combinations of) fields (all share the same default set) + -- + virtual = { + "authoryear", "authoryears", "authornum", "num", "suffix", + }, + -- + -- special datatypes + -- + types = { + -- + -- list of fields that are interpreted as names: "NAME [and NAME]" where + -- NAME is one of the following: + -- + -- First vons Last + -- vons Last, First + -- vons Last, Jrs, First + -- Vons, Last, Jrs, First + -- + author = "author", + editor = "author", + artist = "author", + interpreter = "author", + composer = "author", + producer = "author", + }, + -- + -- categories with their specific fields + -- + categories = { + -- + -- the following fields are for documentation and testing purposes + -- + ["demo-a"] = { + sets = { + author = { "author", "institution", "organization" }, + }, + required = { "author", "title", "year", "note", "url" }, + optional = { "subtitle", "doi", "file" }, + }, + ["demo-b"] = { + sets = { + authors = { "author", "institution", "organization" }, + }, + required = { "authors", "title", "year", "note", "url" }, + optional = { "subtitle", "doi", "file" }, + }, + -- + -- more categories are added below + -- + }, +} + +-- Definition of recognized categories and the fields that they contain. +-- Required fields should be present; optional fields may also be rendered; +-- all other fields will be ignored. + +-- Sets contain either/or in order of precedence. + +local categories = specification.categories + +-- an article from a journal + +categories.article = { + sets = { authors = { "author", "editor", "title" }, links = { "doi", "url" }, }, + required = { + "authors" + }, + optional = { + "year", + "subtitle", "type", "file", + "journal", "volume", "number", "pages", + "note", "links", + }, } -local magazine = { - required = { "authors", "journal", "year" }, - optional = { "subtitle", "volume", "number", "pages", "month", "day", "note", "links", "file" }, - sets = article.sets, +-- an article from a magazine + +categories.magazine = { + sets = categories.article.sets, + required = { + "authors", + "year", + "journal", + }, + optional = { + "subtitle", "type", "file", + "volume", "number", "pages", + "month", "day", + "note", "links", + }, } -local book = { - required = { "authors" }, - optional = { "subtitle", "year", "month", "day", "type", "edition", "series", "volume", "number", "pages", "address", "url", "note", "ISBN", "file" }, - sets = { - authors = { "author", "editor", "publisher", "title" }, +categories.newspaper = categories.magazine + +-- (from jabref) to be identified and setup ... + +categories.periodical = { + sets = { + authors = { "editor", "publisher" }, + }, + required = { + "title", + "year", + }, + optional = { + "authors", + "subtitle", "file", + "series", "volume", "number", "month", + "organization", + "note", }, } -local inbook = { - required = { "authors", "title", "chapter", "pages", "year" }, - optional = { "subtitle", "volume", "number", "series", "type", "address", "edition", "month", "note", "ISBN", "file" }, - sets = book.sets, +-- (from jabref) to be identified and setup ... + +categories.standard = { + sets = { + authors = { "author", "institution", "organization" }, + }, + required = { + "authors", + "year", + "title", "subtitle", + "note", + "url", + }, + optional = { + "doi" + }, } -local booklet = { +-- a book with an explicit publisher. + +categories.book = { + sets = { + authors = { "author", "editor", "publisher", "title" }, + }, required = { "authors" }, - optional = { "subtitle", "howpublished", "address", "month", "year", "note", "file" }, - sets = { - authors = { "author", "title" }, + optional = { + "year", "month", "day", + "subtitle", "type", "file", + "edition", "series", "volume", "number", "pages", + "address", + "url", + "note", "ISBN" }, } -local incollection = { - required = { "authors", "title", "booktitle", "year" }, - optional = { "subtitle", "volume", "number", "series", "type", "chapter", "pages", "address", "edition", "month", "note", "ISBN", "file" }, - sets = { - authors = { "author", "editor", "publisher" }, +-- a part of a book, which may be a chapter (or section or whatever) and/or a range of pages. + +categories.inbook = { + sets = { + authors = { "author", "editor", "publisher", "title", "chapter", "pages" }, + }, + required = { + "authors", + "year" , + }, + optional = { + "subtitle", "type", "file", + "volume", "number", "series", + "edition", "month", + "address", + "note", "ISBN", }, } -local inproceedings = { - optional = { "subtitle", "volume", "number", "series", "pages", "address", "month", "organization", "note", "ISBN", "file" }, - required = incollection.required, - sets = incollection.sets, -} +-- a work that is printed and bound, but without a named publisher or sponsoring institution. -local manual = { - required = { "title" }, - optional = { "subtitle", "author", "organization", "address", "edition", "month", "year", "note", "file" }, +categories.booklet = { + sets = { + authors = { "author", "title" }, + }, + required = { + "authors" + }, + optional = { + "year", "month", + "subtitle", "type", "file", + "address", + "howpublished", + "note", + }, } -local thesis = { - required = { "author", "title", "school", "year", "type" }, - optional = { "subtitle", "address", "month", "note", "file" }, -} +-- a part of a book having its own title. -local misc = { - required = { }, - optional = { "author", "title", "subtitle", "howpublished", "month", "year", "note", "file" }, +categories.incollection = { + sets = { + authors = { "author", "editor", "publisher" }, + }, + required = { + "authors", + "title", "booktitle", + "year", + }, + optional = { + "subtitle", "type", "file", + "month", "edition", + "volume", "number", "series", + "chapter", "pages", + "address", + "note", "ISBN", + }, } -local periodical = { - required = { "title", "year" }, - optional = { "subtitle", "authors", "month", "note", "number", "organization", "series", "volume", "file" }, - sets = { - authors = { "editor", "publisher" }, +-- the proceedings of a conference. + +categories.proceedings = { + required = { + "title", + "year" + }, + optional = { + "editor", + "subtitle", "file", + "volume", "number", "series", "pages", + "month", + "address", "publisher", "organization", + "note", "ISBN" }, } -local proceedings = { - required = { "title", "year" }, - optional = { "subtitle", "editor", "volume", "number", "series", "address", "month", "organization", "publisher", "note", "pages", "ISBN", "file" }, +-- an article in a conference proceedings. + +categories.inproceedings = { + sets = categories.incollection.sets, + required = categories.incollection.required, + optional = { + "subtitle", "type", "file", + "month", + "volume", "number", "series", + "pages", + "address", "organization", + "note", "ISBN" + }, } -local techreport = { - required = { "author", "title", "institution", "year" }, - optional = { "subtitle", "type", "number", "address", "month", "note", "file" }, +categories.conference = categories.inproceedings + +-- a thesis (of course). + +categories.thesis = { + required = { + "author", + "title", + "school", + "year", + "type" + }, + optional = { + "subtitle", "file", + "month", + "address", + "note" + }, } -local other = { - required = { "author", "title", "year" }, - optional = { "subtitle", "note", "doi", "file" }, +categories.mastersthesis = categories.thesis +categories.phdthesis = categories.thesis + +-- a report published by a school or other institution, usually numbered within a series. + +categories.techreport = { + required = { + "author", + "title", + "institution", + "year" + }, + optional = { + "subtitle", "type", "file", + "number", "month", + "address", + "note" + }, } -local patent = { - required = { "nationality", "number", "year", "yearfiled" }, - optional = { "author", "title", "subtitle", "language", "assignee", "address", "type", "day", "dayfiled", "month", "monthfiled", "note", "file" }, +-- technical documentation. + +categories.manual = { + required = { + "title" + }, + optional = { + "subtitle", "file", + "author", "address", "organization", + "edition", "month", "year", + "note", + }, } -local electronic = { - required = { "title" }, - optional = { "subtitle", "address", "author", "howpublished", "month", "note", "organization", "year", "url", "doi", "type", "file" }, +-- a patent (of course). + +categories.patent = { + required = { + "nationality", + "number", + "year", "yearfiled" + }, + optional = { + "type", + --check this: "language", + "author", "assignee", + "title", "subtitle", "file", + "address", + "day", "dayfiled", "month", "monthfiled", + "note" + }, } -local standard = { - required = { "authors", "title", "subtitle", "year", "note", "url" }, - optional = { "doi", "file" }, - sets = { - authors = { "author", "institution", "organization" }, +-- a document having an author and title, but not formally published. + +categories.unpublished = { + required = { + "author", + "title", + "note" + }, + optional = { + "subtitle", "file", + "year", "month" }, } -local unpublished = { - required = { "author", "title", "note" }, - optional = { "subtitle", "month", "year", "file" }, +-- like misc below but includes organization. + +categories.electronic = { + required = { + "title" + }, + optional = { + "subtitle", "type", "file", + "year", "month", + "author", + "address", + "organization", + "howpublished", + "url", "doi", + "note" + }, } -local literal = { - required = { "key", "text" }, - optional = { }, - virtual = false, +-- use this type when nothing else fits. + +categories.misc = { + required = { + -- nothing is really important here + }, + optional = { + "author", + "title", "subtitle", "file", + "year", "month", + "howpublished", + "note" + }, } -return { - name = "apa", - version = "1.00", - comment = "APA specification.", - author = "Alan Braslau and Hans Hagen", - copyright = "ConTeXt development team", - virtual = { - -- all share the same default set - "authoryear", "authoryears", "authornum", "num", "suffix", +-- other (whatever jabref does not know!) + +categories.other = { + required = { + "author", + "title", + "year" }, - types = { - -- - -- list of fields that are interpreted as names: "NAME [and NAME]" where - -- NAME is one of the following: - -- - -- First vons Last - -- vons Last, First - -- vons Last, Jrs, First - -- Vons, Last, Jrs, First - -- - author = "author", - editor = "author", - artist = "author", - interpreter = "author", - composer = "author", - producer = "author", + optional = { + "subtitle", "file", + "note", + "doi" }, - categories = { - article = article, - magazine = magazine, - newspaper = magazine, - book = book, - inbook = inbook, - booklet = booklet, - incollection = incollection, - inproceedings = inproceedings, - conference = inproceedings, - manual = manual, - thesis = thesis, - mastersthesis = thesis, - phdthesis = thesis, - misc = misc, - periodical = periodical, - proceedings = proceedings, - techreport = techreport, - other = other, - patent = patent, - electronic = electronic, - standard = standard, - unpublished = unpublished, - literal = literal, - -- - -- the following fields are for documentation and testing purposes - -- - ["demo-a"] = { - required = { "author", "title", "year", "note", "url" }, - optional = { "subtitle", "doi", "file" }, - sets = { - author = { "author", "institution", "organization" }, - }, - }, - ["demo-b"] = { - required = { "authors", "title", "year", "note", "url" }, - optional = { "subtitle", "doi", "file" }, - sets = { - authors = { "author", "institution", "organization" }, - }, - }, +} + +-- if all else fails to match: + +categories.literal = { + required = { + "key", + "text" }, + optional = { + -- whatever comes up + }, + virtual = false, } +-- done + +return specification |