Rename type dict entry to entrytype according to change in bibtexparser 0.6.1

This commit is contained in:
Lucas Verney 2015-08-21 23:45:19 +02:00
parent 94c2771e4e
commit a25f21f451
3 changed files with 5 additions and 5 deletions

2
bmc.py
View File

@ -220,7 +220,7 @@ def addFile(src, filetype, manual, autoconfirm, tag, rename=True):
# Remove first page of IOP papers # Remove first page of IOP papers
try: try:
if 'IOP' in bibtex['publisher'] and bibtex['type'] == 'article': if 'IOP' in bibtex['publisher'] and bibtex['entrytype'] == 'article':
tearpages.tearpage(new_name) tearpages.tearpage(new_name)
except (KeyError, shutil.Error, IOError): except (KeyError, shutil.Error, IOError):
pass pass

View File

@ -29,7 +29,7 @@ def getNewName(src, bibtex, tag='', override_format=None):
""" """
authors = re.split(' and ', bibtex['author']) authors = re.split(' and ', bibtex['author'])
if bibtex['type'] == 'article': if bibtex['entrytype'] == 'article':
if override_format is None: if override_format is None:
new_name = config.get("format_articles") new_name = config.get("format_articles")
else: else:
@ -38,7 +38,7 @@ def getNewName(src, bibtex, tag='', override_format=None):
new_name = new_name.replace("%j", bibtex['journal']) new_name = new_name.replace("%j", bibtex['journal'])
except KeyError: except KeyError:
pass pass
elif bibtex['type'] == 'book': elif bibtex['entrytype'] == 'book':
if override_format is None: if override_format is None:
new_name = config.get("format_books") new_name = config.get("format_books")
else: else:

View File

@ -46,9 +46,9 @@ def slugify(value):
def parsed2Bibtex(parsed): def parsed2Bibtex(parsed):
"""Convert a single bibtex entry dict to bibtex string""" """Convert a single bibtex entry dict to bibtex string"""
bibtex = '@'+parsed['type']+'{'+parsed['id']+",\n" bibtex = '@'+parsed['entrytype']+'{'+parsed['id']+",\n"
for field in [i for i in sorted(parsed) if i not in ['type', 'id']]: for field in [i for i in sorted(parsed) if i not in ['entrytype', 'id']]:
bibtex += "\t"+field+"={"+parsed[field]+"},\n" bibtex += "\t"+field+"={"+parsed[field]+"},\n"
bibtex += "}\n\n" bibtex += "}\n\n"
return bibtex return bibtex