diff --git a/create_tmpbib.py b/create_tmpbib.py index 389050e..b89f11b 100644 --- a/create_tmpbib.py +++ b/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