Skip to main content

to_bibtex

Function to_bibtex 

Source
pub fn to_bibtex(citation_key: &str, m: &Metadata) -> String
Expand description

Render a single BibTeX entry for m, keyed by citation_key.

journal-article@article; everything else → @misc (Phase 2 starter — @inproceedings / @book mapping is a follow-up). Field order: title, author, year, doi, journal, publisher, issn; any empty / None field is omitted. The returned string is a complete entry terminated by }\n.

Literal { / } in a field value would unbalance the surrounding braces; they are stripped (with a tracing::warn!) rather than TeX-escaped — real-world Crossref / Unpaywall titles rarely contain bare braces, so this is safe-by-default for the Phase 2 starter.