Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions bin/arxiv_to_publications_correct.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,16 @@
id = data['author'][0]['family'] + 'EtAl' + str(data['issued']['date-parts'][0][0])
else:
id = data['author'][0]['family'] + str(data['issued']['date-parts'][0][0])
assert id == id_db, f"ID generated with new DOI ({id}) is different than the original in database ({id_db})"
if id != id_db:
print(f'Note: ID generated with new DOI ({id}) differs from the original in database ({id_db}). Keeping original ID.')

entries = db.get_entry_dict()
assert entries[id]["ENTRYTYPE"] == 'unpublished', "original entry in bib file was NOT unpublished !"
db.entries.remove(entries[id])
assert entries[id_db]["ENTRYTYPE"] == 'unpublished', "original entry in bib file was NOT unpublished !"
db.entries.remove(entries[id_db])

bType, *rest1 = bib.split("{")
oldID, *rest2 = rest1[0].split(",")
bib = "{".join([bType] + [','.join([id]+rest2)] + rest1[1:])
bib = "{".join([bType] + [','.join([id_db]+rest2)] + rest1[1:])
bib_db = bibtexparser.loads(bib)
db.entries.extend(bib_db.get_entry_list())

Expand Down
Loading