Permalink
Browse files

Formatted bibliographies can contain blank lines

  • Loading branch information...
kthoden committed Apr 5, 2018
1 parent 9bde75d commit b7a47f29ed72d80121c7cd0c13a19bcdc7bdfbd8
Showing with 13 additions and 7 deletions.
  1. +13 −7 create_tmpbib.py
@@ -59,13 +59,19 @@ def tmp_citations(formatted_bibliography):
citations = formbib.readlines()

for citation in citations:
matches = re.match(authoryear_pattern, citation)
try:
tmp_citekey = "{}_{}".format(matches.group(1), matches.group(3))
tmp_citekey_dict[tmp_citekey] = citation
except AttributeError:
tmp_citekey_dict["None_{:03d}".format(nonematcher)] = citation
nonematcher += 1
print(len(citation))
if len(citation) > 2:
logging.debug("Creating temporary citekey from %s." % citation)
matches = re.match(authoryear_pattern, citation)
try:
tmp_citekey = "{}_{}".format(matches.group(1), matches.group(3))
tmp_citekey_dict[tmp_citekey] = citation
except AttributeError:
tmp_citekey_dict["None_{:03d}".format(nonematcher)] = citation
nonematcher += 1

else:
logging.debug("Skipping blank line")

return tmp_citekey_dict
# def tmp_citations ends here

0 comments on commit b7a47f2

Please sign in to comment.