Skip to content

Commit 1c6733a

Browse files
authored
Normalize malformed DOI month values in bibbot
1 parent 7ac911f commit 1c6733a

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

bin/issue_to_bibtex.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,12 @@
149149
bib = re.sub(r'(@[a-z]*{)(.*?),', r'\1' + id + ',', bib)
150150
url_bad = re.search(r'url\s*=\s*{(.*)}', bib).groups()[0]
151151
bib = re.sub(r'(url\s*=\s*{)(.*)}', r'\1' + urllib.parse.unquote(url_bad) + '}', bib)
152+
bib = re.sub(
153+
r'(^\s*month\s*=\s*)(?:[\'"]?)([A-Za-z]+)(?:[\'"]?)\s*,',
154+
r'\1{\2},',
155+
bib,
156+
flags=re.MULTILINE,
157+
)
152158
bib_db = bibtexparser.loads(bib)
153159
print(bib)
154160
else:

0 commit comments

Comments
 (0)