Prepyrus
Prepyrus is a tool for verifying and processing MDX files that contain citations in Chicago author-date style and certain metadata.
Usage
Add the crate to your Cargo.toml and use it as shown below:
[]
= "0.1"
Main API interface is the run_prepyrus function. Example usage:
use run_prepyrus;
The function takes three arguments: <bibliography.bib> <target_dir_or_file> <mode>
- a bibliography file (.bib),
- a target directory or .mdx file,
- and a mode (either
verifyorprocess).
verify mode only verifies the citations in the MDX files against the bibliography.
⚠️ NOTE: process mode modifies the MDX files.
process mode additionally processes the MDX files by injecting bibliography and other HTML details into the MDX files.
Description
The tool is designed to work with MDX files that contain citations in Chicago author-date style. Examples:
"...nowhere on heaven or on earth is there anything which does not contain both being and nothing in itself" (Hegel 2010, 61).
The tool parses and verifies the citations in the MDX files against a bibliography file in BibTeX format (using Biblatex). If the citations are valid, the tool processes the MDX files by adding a bibliography section at the end of the file. It also adds author, editor, and contributor from the MDX file metadata if available. Finally, it also adds a notes heading at the end if footnotes are present in the file.
The tool has two modes: verify and process.
In verify mode, the tool only verifies the citations in the MDX files
and matches them against the bibliography.
In process mode, the tool additionally processes the MDX files by injecting bibliography
and other details into the MDX files.
Limitations
The tool currently only supports citations in Chicago author-date style.
Only book entries are currently supported (plans to support more types in the future).
Only the following metadata fields are supported:
- author
- editor
- contributor
Examples
To see a working implementation of prepyrus, please visit the sPhil repo.
Acknowledgements
Thanks to Typst's biblatex package for providing an awesome library for parsing BibTex files, the people behind serde and regex Rust crates and the Rust community!
License
Apache-2.0