diff --git a/src/eoatex2imxml.py b/src/eoatex2imxml.py index 3ae19b9..d78a2af 100755 --- a/src/eoatex2imxml.py +++ b/src/eoatex2imxml.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 # -*- coding: utf-8; mode: python -*- -# Time-stamp: <2020-09-03 15:57:40 (kthoden)> +# Time-stamp: <2020-09-04 13:46:35 (kthoden)> """ Converts Latex files into a customized DocBook XML file. @@ -1104,6 +1104,23 @@ def make_indices_child_of_div0(): parent_div.append(section) # def make_indices_child_of_div0 ends here +def check_footnote_paragraphs(): + """Check if footnotes contain more than one paragraph""" + + grep_command = "grep -A1 -B2 'argument of \\\EOAfn' {}".format( + LOG_DIR / SCRIPT_NAME / (INPUT_PATH.stem + "-tralics.log") + ) + grep_command_arguments = shlex.split(grep_command) + grep_result = subprocess.Popen(grep_command_arguments, stdout=subprocess.PIPE) + grep_output = grep_result.stdout.read() + if len(grep_output) > 0: + logging.warning("\n===\nFootnotes with paragraphs were found. They have to be replaced by the \EOAfnpar command.\n") + logging.warning(grep_output.decode("utf-8")) + logging.warning("===\n") + else: + logging.inf("Footnote check found no errors") +# def check_footnote_paragraphs ends here + ############################################################## # Preparing the Bibliography # ############################################################## @@ -1878,16 +1895,7 @@ def add_bibliography_to_xml( # Pickle the 'data' dictionary using the highest protocol available. pickle.dump(data_to_pickle, f, pickle.HIGHEST_PROTOCOL) -grep_command = "grep -A1 -B2 'argument of \\\EOAfn' {}".format( - LOG_DIR / SCRIPT_NAME / (INPUT_PATH.stem + "-tralics.log") -) -grep_command_arguments = shlex.split(grep_command) -grep_result = subprocess.Popen(grep_command_arguments, stdout=subprocess.PIPE) -grep_output = grep_result.stdout.read() -if len(grep_output) > 0: - logging.info("\n===\nFootnotes with paragraphs were found. They have to be replaced by the \EOAfnpar command.\n") - logging.info(grep_output.decode("utf-8")) - logging.info("===\n") +check_footnote_paragraphs() logging.info("Removing temporary files.") cleanup()