Module bibliography

Source
Expand description

Native bibliography formatting — APA and IEEE styles.

§Why native?

The full CSL (Citation Style Language) spec supports 9000+ styles, but we only use 2-3 regularly. Implementing those natively eliminates the last BBT dependency for common usage. BBT remains as fallback for exotic styles.

§Reference implementation

These formatters were built from the official CSL style definitions:

The Python MCP server delegated this to BBT’s CSL engine via JSON-RPC (item.bibliography method at bbt_client.py:99). That engine uses citeproc-js internally. Our native implementation handles the common cases; edge cases (non-Latin scripts, legal citations, etc.) fall back to BBT.

§Verification

To verify output matches BBT’s CSL engine, compare:

# Native (Rust):
echo '...tools/call zotero_get_bibliography...' | biblion-rs

# BBT reference (Python, requires Zotero running):
curl -X POST http://localhost:23119/better-bibtex/json-rpc \
  -d '{"jsonrpc":"2.0","id":1,"method":"item.bibliography",
       "params":[["citekey"],{"id":"http://www.zotero.org/styles/apa"}]}'

Functions§

format_apa 🔒
format_apa_authors 🔒
Format authors in APA style: “Last, F. I., Last2, F. I., & Last3, F. I.”
format_bibliography
Format a bibliography entry in the requested style.
format_bibliography_list
Format multiple items as a numbered bibliography.
format_ieee 🔒
format_ieee_authors 🔒
Format authors in IEEE style: “F. I. Last, F. I. Last, and F. I. Last”
is_native_style
Supported native styles. Anything else falls back to BBT.