mayanklahiri / bib2json

Javascript Bibtex to JSON for nodejs and the browser

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

bib2json

Javascript Bibtex to JSON for nodejs and the browser. It can:

  • operate in streaming or block mode, extracting entries as arrays of dictionaries.
  • convert Latex directives to UTF-8.
  • best-effort parse malformed entries.
  • run in a CommonJS environment (e.g., node) or a browser, without any dependencies.
  • be advanced-compiled by Google Closure Compiler.
  • parse "real-world" Bibtex, such as those found here.

Handwritten as a labor of love, not cruelly auto-generated from a grammar, tested with Jasmine.

Usage

Synchronous, block mode:

var entries = BibtexParser(text);
console.log(entries);

Asynchronous, stream mode:

var entryCallback = function(entry) { console.log(entry); }
var parser = new BibtexParser(entryCallback);
parser.parse(chunk1);
parser.parse(chunk2);

About

Javascript Bibtex to JSON for nodejs and the browser


Languages

Language:TeX 98.7%Language:JavaScript 1.2%Language:CSS 0.0%Language:HTML 0.0%Language:Python 0.0%