Revert "Convert to BibLatex format"

I have made a cleanup of my database with the option “Convert to BibLatex format” checked. Not only the journal key has changed to journaltitle but also year to date. The year key is not there anymore, and date does not seem compatible with bibtex.

Is it possible to revert the database format from biblatex to bibtex again?

Thanks

Hi Pablo,

unfortunately this is not possible (despite just using the “undo” functionality). If you had just the year in the bibtex data without having a month it would be possible to use the function “Quality” -> “Set/clear/rename fields” to rename the field “date” to “year” - but this does not work if there is a date such as “2005-06”.

In this case only external tools, e.g., text editors with good search and replace functionality based on regular expressions might help to restore the previous state.

Best regards
Matthias

Thanks for the reply, Matthias. I solved the problem with the following python script.

import re
old_db = open("biblatex.bib","r")
new_db = open("bibtex.bib","w")
for line in old_db.readlines():
    date_pattern = re.search("date.*{(\d+)-?(\d+)?}",line)
    if date_pattern:
        new_db.write("year={{{0:s}}},\n".format(date_pattern.group(1)))
        print "year={{{0:s}}},\n".format(date_pattern.group(1)),
        if date_pattern.group(2) != None:
            new_db.write("month={{{0:s}}},\n".format(date_pattern.group(2)))
        continue
    if re.search("journaltitle",line):
        new_db.write(line.replace("journaltitle","journal"))
        continue
    new_db.write(line)
old_db.close()
new_db.close()

Best regards,
Pablo

1 Like

Good to hear that you were able to restore your data!