1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
//! *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")
//!         ]
//!     )));
//! }
//! ```
//!
#[macro_use]
extern crate nom;

pub mod error;
mod parser;
mod model;

pub use model::{Bibtex, Entry, BibliographyEntry};