Skip to content

Instantly share code, notes, and snippets.

@Phyks
Created April 26, 2014 13:17
Show Gist options
  • Save Phyks/11319857 to your computer and use it in GitHub Desktop.
Save Phyks/11319857 to your computer and use it in GitHub Desktop.
def parsed2Bibtex(parsed):
"""
Convert a single bibtex entry dict to bibtex string
"""
data = parsed.get_entry_dict()
bibtex = ''
for entry in data.keys():
bibtex += '@'+data[entry]['type']+'{'+data[entry]['id']+",\n"
for field in [i for i in sorted(data[entry]) if i not in ['type', 'id']]:
bibtex += "\t"+field+"={"+data[entry][field]+"},\n"
bibtex += "}\n\n"
return bibtex
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment