diff --git a/eoatex2imxml.py b/eoatex2imxml.py index 57940b6..100a92e 100755 --- a/eoatex2imxml.py +++ b/eoatex2imxml.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 # -*- coding: utf-8; mode: python -*- -# Time-stamp: <2018-08-24 17:17:19 (kthoden)> +# Time-stamp: <2018-08-30 17:51:23 (kthoden)> """ Converts Latex files into a customized DocBook XML file. @@ -1417,7 +1417,11 @@ def cleanup(): strTitle = current_citation["title"] # [1:-1] to remove parentheses around citations - citeauthoryear_value = form_cit.select("#citeauthoryear ~ p > span[data-cites='%s']" % string_citekey)[0].text[1:-1] + try: + citeauthoryear_value = form_cit.select("#citeauthoryear ~ p > span[data-cites='%s']" % string_citekey)[0].text[1:-1] + except IndexError: + print("Could not find {}. Exiting.".format(string_citekey)) + sys.exit() data_title_value = citeauthoryear_value if xmlCitation.tag == "EOAciteauthoryear": strCitation = citeauthoryear_value