A .Net library for working with bibtex files. Contains custom parser for reading bibtex files.
- .NET framework 4 or higher
Currently only loading from a string is supported.
BibtexFile file = BibtexLibrary.BibtexImporter.FromString(@"@book{ aaker:1981a,
author = {David A. Aaker},
title = {Multivariate Analysis in Marketing},
edition = {2},
publisher = {The Scientific Press},
year = {1981},
address = {Palo Alto},
topic = {multivariate-statistics;market-research;}
}");
foreach (BibtexEntry entry in file.Entries)
{
Console.WriteLine(entry.Tags["author"]);
}
The above code will print:
David A. Aaker
The grammar that is used by the parser is as follows. It is not in perfect EBNF, but it should be usable.
BibtexFile = { ([junk] @ (stringDef|entry) }
entry = type openingbrace key comma {(tag[comma])} closingbrace
stringDef = [S|s]tring openingbrace tag closingbrace
tag = text "=" (valuestart text valuestop) | text
type = text
key = text
valuestart = openingbrace | valuequote
valuestop = closingbrace | valuequote
comma = ","
openingbrace = "{"
closingbrace = "}"
valuequote = """
text = { ([~'A-z0-9:.\s-()/\?&\\] | Comma) }
junk = .*