Skip to content

Commit

Permalink
Update bib mappings
Browse files Browse the repository at this point in the history
  • Loading branch information
zepinglee committed Mar 4, 2022
1 parent 1138de4 commit 0c17cb4
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 49 deletions.
57 changes: 31 additions & 26 deletions citeproc/citeproc-bib-data.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"source": "bibtex"
},
"artifactdataset": {
"csl": null,
"csl": "dataset",
"source": "ACM-Reference-Format.bst"
},
"artifactsoftware": {
Expand All @@ -37,7 +37,7 @@
"source": "biblatex"
},
"bachelor": {
"csl": null,
"csl": "thesis",
"source": "dlfltxbbibtex.bst"
},
"bibnote": {
Expand All @@ -58,7 +58,7 @@
"source": "bibtex"
},
"brochure": {
"csl": null,
"csl": "pamphlet",
"source": "thesnumb.bst"
},
"cconference": {
Expand All @@ -75,7 +75,7 @@
"source": "bibtex"
},
"commentary": {
"csl": null,
"csl": "book",
"notes": "Not supported.",
"source": "biblatex"
},
Expand Down Expand Up @@ -125,11 +125,11 @@
"source": "biblatex"
},
"dictionary": {
"csl": null,
"csl": "book",
"source": "vancouver.bst"
},
"docthesis": {
"csl": null,
"csl": "thesis",
"source": "gost2003.bst"
},
"electronic": {
Expand All @@ -138,7 +138,7 @@
"source": "biblatex"
},
"eulegislation": {
"csl": null,
"csl": "legislation",
"source": "bath.bst"
},
"footnote": {
Expand All @@ -154,7 +154,7 @@
"source": "thesnumb.bst"
},
"habthesis": {
"csl": null,
"csl": "thesis",
"source": "bestpapers-export.bst"
},
"heading": {
Expand All @@ -178,11 +178,12 @@
"source": "bibtex"
},
"inloosecollection": {
"csl": null,
"csl": "chapter",
"source": "resphilosophica.bst"
},
"inpress": {
"csl": null,
"csl": "article",
"notes": "Use for preprints, working papers, and similar works posted on a platform where some level of persistence or stewardship is expected (e.g. arXiv or other preprint repositories, working paper series).",
"source": "bjnano.bst"
},
"inproceedings": {
Expand All @@ -199,15 +200,15 @@
"source": "asmejour.bst"
},
"internet": {
"csl": null,
"csl": "webpage",
"source": "IEEEtran.bst"
},
"journalpart": {
"csl": null,
"source": "abntex2-alf.bst"
},
"journals": {
"csl": null,
"csl": "periodical",
"source": "bestpapers-export.bst"
},
"jurisdiction": {
Expand All @@ -216,7 +217,7 @@
"source": "biblatex"
},
"jurthesis": {
"csl": null,
"csl": "thesis",
"source": "jurabib.bst"
},
"legal": {
Expand All @@ -234,11 +235,11 @@
"source": "biblatex"
},
"lexicon": {
"csl": null,
"csl": "book",
"source": "jurabib.bst"
},
"majorthesis": {
"csl": null,
"csl": "thesis",
"source": "achicago.bst"
},
"manual": {
Expand All @@ -256,11 +257,11 @@
"source": "bibtex"
},
"masterthesis": {
"csl": null,
"csl": "thesis",
"source": "asaetr.bst"
},
"minorthesis": {
"csl": null,
"csl": "thesis",
"source": "achicago.bst"
},
"misc": {
Expand All @@ -269,11 +270,11 @@
"source": "bibtex"
},
"monograph": {
"csl": null,
"csl": "book",
"source": "gbt7714-numerical.bst"
},
"monography": {
"csl": null,
"csl": "book",
"source": "abntex2-alf.bst"
},
"movie": {
Expand Down Expand Up @@ -342,10 +343,12 @@
},
"preprint": {
"csl": "article",
"notes": "Use for preprints, working papers, and similar works posted on a platform where some level of persistence or stewardship is expected (e.g. arXiv or other preprint repositories, working paper series).",
"source": "gbt7714-numerical.bst"
},
"presentation": {
"csl": null,
"csl": "speech",
"notes": "A speech or other presentation (e.g. a paper, talk, poster, or symposium at a conference).",
"source": "apsrev4-2.bst"
},
"proceedings": {
Expand Down Expand Up @@ -423,11 +426,12 @@
"source": "biblatex"
},
"uklegislation": {
"csl": null,
"csl": "legislation",
"source": "bath.bst"
},
"unpublished": {
"csl": "manuscript",
"notes": "For unpublished works not made widely available or only hosted on personal websites, use manuscript",
"source": "bibtex"
},
"video": {
Expand Down Expand Up @@ -498,11 +502,12 @@
"type": "name"
},
"annotate": {
"csl": null,
"csl": "note",
"source": "apacite.bst"
},
"annotation": {
"csl": null,
"csl": "note",
"notes": "Descriptive text or notes about an item (e.g. in an annotated bibliography)",
"source": "biblatex",
"type": "literal"
},
Expand All @@ -513,7 +518,7 @@
},
"annote": {
"alias": "annotation",
"csl": null,
"csl": "note",
"source": "biblatex",
"type": "literal"
},
Expand All @@ -526,7 +531,7 @@
"source": "seuthesix.bst"
},
"archive": {
"csl": null,
"csl": "archive",
"source": "apsrev4-2.bst"
},
"archiveprefix": {
Expand All @@ -536,7 +541,7 @@
"type": "literal"
},
"archname": {
"csl": null,
"csl": "archive",
"source": "jurabib.bst"
},
"articleno": {
Expand Down
33 changes: 15 additions & 18 deletions citeproc/citeproc-bib.lua
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,8 @@ function bib.parse_item(contents)

bib_type = string.lower(bib_type)
local type_data = bib.bib_data.types[bib_type]
if type_data then
if type_data.csl then
item.type = type_data.csl
else
item.type = "document"
end
if type_data and type_data.csl then
item.type = type_data.csl
else
item.type = "document"
end
Expand Down Expand Up @@ -347,7 +343,9 @@ function bib.parse_single_date(str)
return date
end


function bib.process_special_fields(item, bib_fields)
-- Default entry type `document`
if item.type == "document" then
if item.URL then
item.type = "webpage"
Expand All @@ -356,17 +354,12 @@ function bib.process_special_fields(item, bib_fields)
end
end

if item.type == "article-journal" then
if not item["container-title"] then
item.type = "article"
end
end

-- event-title: for compatibility with CSL v1.0.1 and earlier versions
if item["event-title"] then
item.event = item["event-title"]
end

-- issued date
if bib_fields.year and not item.issued then
item.issued = bib.parse_date(bib_fields.year)
end
Expand Down Expand Up @@ -395,23 +388,27 @@ function bib.process_special_fields(item, bib_fields)
-- end
-- end

-- number
if item.number then
if not item.issue and item.type == "article-journal" or item.type == "article-magazine" or item.type == "article-newspaper" or item.type == "periodical" then
item.issue = item.number
item.number = nil
elseif item.type == "patent" or item.type == "report" or item.type == "standard" then
else
if item.type == "article-journal" or item.type == "article-magazine" or item.type == "article-newspaper" or item.type == "periodical" then
if not item.issue then
item.issue = item.number
item.number = nil
end
elseif item["collection-title"] and not item["collection-number"] then
item["collection-number"] = item.number
item.number = nil
end
end

if not item.PMID and bib_fields.eprint and string.lower(bib_fields.eprinttype) == "pubmed" then
-- PMID
if bib_fields.eprint and string.lower(bib_fields.eprinttype) == "pubmed" and not item.PMID then
item.PMID = bib_fields.eprint
end

end


bib.babel_locale_mapping = {
acadian = "fr-CA",
american = "en-US",
Expand Down
10 changes: 5 additions & 5 deletions tools/bib-csl-mapping.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Bib|CSL|Notes
`@booklet`|`pamphlet`|
`@collection`|`book`|
`@comment`|-|Special entry type for Scribe compatibility
`@commentary`|-|Not supported.
`@commentary`|`book`|Not supported.
`@conference`|`paper-conference`|Alias for `@inproceedings`.
`@dataset`|`dataset`|
`@electronic`|`webpage`|Alias for `@online`.
Expand Down Expand Up @@ -55,7 +55,7 @@ Bib|CSL|Notes
`@suppperiodical`|`article`|see `article`
`@techreport`|`report`|Alias for `@report`.
`@thesis`|`thesis`|
`@unpublished`|`manuscript`|
`@unpublished`|`manuscript`|For unpublished works not made widely available or only hosted on personal websites, use manuscript
`@video`|`motion_picture`|
`@www`|`webpage`|Alias for `@online`.
`@xdata`|-|special item type: "`@xdata` entries hold data which may be inherited by other entries using the xdata field. Entries of this type only serve as data containers; they may not be cited or added to the bibliography."
Expand All @@ -69,9 +69,9 @@ Bib|CSL|Notes
`addendum`|-|Not supported.
`address`|`publisher-place`|Alias for `location`.
`afterword`|-|Not supported.
`annotation`|-|
`annotation`|`note`|Descriptive text or notes about an item (e.g. in an annotated bibliography)
`annotator`|-|
`annote`|-|Alias for `annotation`.
`annote`|`note`|Alias for `annotation`.
`archiveprefix`|`archive`|Alias for `eprinttype`.
`author`|`author`|
`authortype`|-|
Expand All @@ -95,7 +95,7 @@ Bib|CSL|Notes
`eprintclass`|-|
`eprinttype`|`archive`|
`eventdate`|`event-date`|
`eventtitle`|`event`|Will be mapped to `event-title` in CSL v1.0.2.
`eventtitle`|`event-title`|Supercedes `event` in CSL v1.0.2.
`eventtitleaddon`|-|
`execute`|-|Not supported.
`file`|-|
Expand Down
7 changes: 7 additions & 0 deletions tools/update-bib-data.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,13 @@ def __init__(self, path):

def update_bibtex(self):
self.update_bst('plain.bst', 'bibtex')
self.update_bst('unsrt.bst', 'bibtex')
self.update_bst('alpha.bst', 'bibtex')
self.update_bst('abbrv.bst', 'bibtex')
self.update_bst('acm.bst', 'bibtex')
self.update_bst('apalike.bst', 'bibtex')
self.update_bst('ieeetr.bst', 'bibtex')
self.update_bst('siam.bst', 'bibtex')

def update_bst(self, file_name, source=None):
if os.path.exists(file_name):
Expand Down

0 comments on commit 0c17cb4

Please sign in to comment.