Expand description
A boring BibTeX formatter.
boringbib is a small command-line tool for BibTeX .bib files with two
jobs:
fmt: sort entries by citation key and pretty-print each entry with the=signs aligned, exactly like LaTeX Workshop’s “Align and sort” action.keys: rewrite citation keys into Google Scholar style (vaswani2017attention), updating in-file references so nothing dangles.
The library is organized as a pipeline over a lossless concrete syntax tree:
text ──parse()──▶ Cst ──sort::group()/sort()──▶ printer::format() ──▶ text
│
└──keys::plan()──▶ Plan ──keys::apply()──▶ textThe parser (parser, built on lexer) keeps every byte of the input
in the Cst; Cst::to_source() reproduces the input exactly. All
formatting decisions live in printer and sort; keys edits are
splices of the original text at recorded spans. This separation is what
makes the tool boring: deterministic output, idempotent runs, and no loss
of the user’s data.
The binary lives in cli; see DESIGN.md in the repository for the
decisions behind the grammar and the output rules.
Re-exports§
pub use cst::Cst;pub use lexer::ParseError;pub use parser::parse;pub use printer::FmtOptions;pub use printer::format;pub use printer::format_str;
Modules§
- cli
- The command-line interface: argument definitions, option resolution and
the
runfunction the binary calls. - config
- The optional
boringbib.tomlconfiguration file. - cst
- The lossless concrete syntax tree.
- keys
- Citation key rewriting: the
keyscommand. - lexer
- Character-level scanning over the source text.
- parser
- The BibTeX grammar: turns text into a
Cst. - printer
- Pretty-printing a
Cst: thefmtcommand. - sort
- Ordering of blocks for the printer.
Enums§
- Error
- Errors reported by the library when working with files.