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:
JavaScript
x
8
1
>>> from pybtex.database.input import bibtex
2
>>> parser = bibtex.Parser()
3
>>> bib_data = parser.parse_file('examples/foo.bib')
4
>>> bib_data.entries.keys()
5
[u'ruckenstein-diffusion', u'viktorov-metodoj', u'test-inbook', u'test-booklet']
6
>>> print bib_data.entries['ruckenstein-diffusion'].fields['title']
7
Predicting the Diffusion Coefficient in Supercritical Fluids
8
Good luck.