This pandoc lua filiter helps users to insert references in a document with using DOI(Digital Object Identifier) tags. With this filter, user s do not need to make bibtex file by themselves. Instead, the filter automatically generate bib file from the DOI tags, and convert the DOI tags into citation keys available by --citeproc.
What the filter do are as follows:
- Search citations with DOI tags in the document
- Search corresponding bibtex data from
__from_DOI.bib
file - If not found, get bibtex data of the DOI from http://api.crossref.org
- Add reference data to
__from_DOI.bib
file - Check duplications of reference keys
- Replace DOI tags to the correspoinding citation keys
- Pandoc version 2.0 or newer
- This filter does not need any external dependencies
- This filter should be executed before
pandoc-crossref
or--citeproc
Following DOI tags can be used:
- @https://doi.org/
- @doi.org/
- @DOI:
- @doi:
The first one (@https://doi.org/) may be the most useful because it is same as the accessible URL.
The file name of the auto-generated bibliography file MUST be
__from_DOI.bib
, but the place of the file can be changed (e.g.
'./refs/__from_DOI.bib'
or 'refs\\__from_DOI.bib'
for Windows). Yo
u can designate the filepath in the document yaml header. The yaml key
is bibliography
, which is also used by --citeproc.
example1.md:
---
bibliography:
- 'my_refs.bib'
- '__from_DOI.bib'
---
# Introduction
The Laemmli system is one of the most widely used gel systems for the
separation of proteins.[@LAEMMLI_1970] By the way, Einstein is genius.
[@https://doi.org/10.1002/andp.19053220607; @doi.org/10.1002/andp.1905
3220806; @doi:10.1002/andp.19053221004]
Example command 1 (.md -> .md)
pandoc --lua-filter=doi2cite.lua --wrap=preserve \
-s example1.md -o expected1.md
Example command 2 (.md -> .pdf with ACS style):
pandoc --lua-filter=doi2cite.lua --filter=pandoc-crossref --citeproc \
--csl=sample1.csl -s example1.md -o expected1.pdf