citeproc-cli
v0.3.0
Published
Simple cli for citeproc-js
Downloads
5
Readme
citeproc-cli
Requires node>=12.0.0
Rather simplistic command line wrapper around citeproc-js. It can be packaged by pkg to provide citeproc functionality with a simple api in a portable form.
Since my use case is a Markdown conversion library, this tool renders citations and bibliography as HTML.
Flags
--data
/-d
Required
Path to a text file containing your bibliographic library in CSLJSON.
--style
/-s
Required
Path to a CSL file containing your bibliographic style in XML format.
--bibliography
/-b
Default: false
Render bibliography (omit to render citations to use in footnotes/endnotes)
--localedir
/-j
Default: ./locales
Path to a directory containing CSL locale files in XML format. Ideally, this directory would be a clone of the CSL locale repository.
--locale
/-l
Default: en-US
Desired locale as RFC 5646 compliant string.
--keys
/-k
Default: []
JSON-serialized list containing cited keys (without a preceding @
). Either wrap in single quotes (which should always be possible since allowed characters in CSL keys are limited) or avoid white space. One list entry can contain multiple keys separated by ;
. This flag is overridden by --references
/-r
and --reffile
/-p
.
Example:
citeproc-cli -k '["citekey1", "citekey2;citekey3", "citekey4"]'
--references
/-r
Default: []
JSON serialized array of arrays of dictionaries containing references. Every dictionary must contain at least the key ìd
(value: citekeys without a preceding @
) but can contain additional keys to pass to the citation processor. The deserialized dictionaries are directly passed as citationItems
and can therefore contain any of the keys mentioned in the citeproc-js documentation. Each array of dictionaries is treated as one citation. This flag overrides --keys
/-k
and is overridden by --reffile
/-p
.
Example:
citeproc-cli -r '[[{"id": "citekey1", "prefix": "ct."}, {"id": "citekey2", "suffix": "p. 16"}], [{"id": "citekey1"}]]'
--reffile
/-p
Default: null
Path to a file containing the same JSON serialized data you would pass with --references
/-r
. While probably a little slower than the former, it's useful for bigger data sets or if you don't want to mess with escaping. This flag overrides --keys
/-k
and --references
/-r
.
--uncited
/-u
Default: []
JSON-serialized list containing uncited keys to add to bibliography (without a preceding @
). Either wrap in single quotes (which should always be possible since allowed characters in CSL keys are limited) or avoid white space. One list entry can contain multiple keys separated by ;
Example:
citeproc-cli -u '["citekey1", "citekey2;citekey3", "citekey4"]'
--nojson
/-n
Default: false
Debugging option: Don't JSON-stringify output to make STDOUT a bit easier to read.
Error codes
Packaging
Run pkg on the package:
npm install .
npm install --only=dev .
./node_modules/.bin/pkg .
Optionally, use the --target
attribute to build for a system/architecture that is not mentioned in package.json.