Crate nom_bibtex [] [src]

nom-bibtex is a bibtex parser. The library handles many specials features of bibtex such as:

  • Preambles
  • Variables
  • Comments

Here is a sample of code using nom-bibtex.

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"));
    assert_eq!(entries[1], Entry::Bibliography(BibliographyEntry::new(
        "misc",
        "my_citation_key",
        vec![
            ("author", "Charles Vandevoorde"),
            ("title", "nom-bibtex")
        ]
    )));
}

Modules

error

Structs

BibliographyEntry

An entry of a bibtex bibliography.

Bibtex

A high-level definition of a bibtex file that contains multiples entries.

Enums

Entry

Describe an entry in the bibtex file. We can have 4 types of entries: