Created
October 27, 2022 15:25
-
-
Save jmuhlich/f921c929668f4ead8383fd8ed6c83fe9 to your computer and use it in GitHub Desktop.
Quick script to convert .bib bibtex to yaml (in no particular schema)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import bibtexparser | |
from pylatexenc.latex2text import LatexNodes2Text | |
import sys | |
import yaml | |
lt = LatexNodes2Text() | |
with open(sys.argv[1]) as f: | |
db = bibtexparser.load(f) | |
for e in db.entries: | |
for k, v in e.items(): | |
e[k] = lt.latex_to_text(v) | |
print(yaml.dump(db.entries, allow_unicode=True)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment