I’m developing using Python and Django for a website. I want to take a BibTex entry and output it in a view in 3 different formats, MLA, APA, and Chicago. Is there a library out there that already does this or am I going to have to manually do the string formatting?
Advertisement
Answer
There are the following projects:
If you need complex parsing and output, Pybtex is recommended. Example:
>>> from pybtex.database.input import bibtex >>> parser = bibtex.Parser() >>> bib_data = parser.parse_file('examples/foo.bib') >>> bib_data.entries.keys() [u'ruckenstein-diffusion', u'viktorov-metodoj', u'test-inbook', u'test-booklet'] >>> print bib_data.entries['ruckenstein-diffusion'].fields['title'] Predicting the Diffusion Coefficient in Supercritical Fluids
Good luck.