nom-bibtex 0.1.0

BibTeX zero-copy parser using nom
Documentation

nom-bibtex

Build Status

A nearly feature complete BibTeX zero-copy parser using nom.

nom-bibtex can parse the four different type of entries listed in the BibTeX format description:

  • Preamble which allows to call LaTeX command inside your BibTeX.
  • String which defines abbreviations in a key-value format.
  • Comment
  • Entry which defines a bibliography entry.

Code example

extern crate nom_bibtex;
use nom_bibtex::*;

const BIBFILE_DATA: &str = "
    @preamble{
        A bibtex preamble
    }

    @misc{my_citation_key,
        author= {Charles Vandevoorde},
        title = \"nom-bibtex\"
    }
";

fn main() {
    let biblio = Bibtex::parse(BIBFILE_DATA).unwrap();
    let entries = biblio.entries();

    assert_eq!(entries[0], Entry::Preamble("A bibtex preamble".into()));
    assert_eq!(entries[1], Entry::Bibliography(BibliographyEntry::new(
        "misc",
        "my_citation_key",
        vec![
            ("author".into(), "Charles Vandevoorde".into()),
            ("title".into(), "nom-bibtex".into())
        ]
    )));
}

TODO

  • The string variable are not yet used.