From 724f9eeaa0a1bebfe65ef31a19077ae53eb0e46a Mon Sep 17 00:00:00 2001 From: kthoden Date: Fri, 4 Sep 2020 13:33:51 +0200 Subject: [PATCH] Move function into function definition block --- src/eoatex2imxml.py | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/eoatex2imxml.py b/src/eoatex2imxml.py index 90e6379..3ae19b9 100755 --- a/src/eoatex2imxml.py +++ b/src/eoatex2imxml.py @@ -1088,6 +1088,21 @@ def process_pararefs(xmlTree): pararef.tag = "elementtobestripped" # def process_pararefs ends here +def make_indices_child_of_div0(): + """Move index commands to a higher location""" + + index_sections = xmlTree.xpath(" .//EOAprintpersonindex | .//EOAprintlocationindex | .//EOAprintindex") + logging.debug(f"Found {libeoaconvert.plural(len(index_sections), 'index section')}.") + + if index_sections: + for section in index_sections: + try: + parent_div = section.xpath("./ancestor::div0")[0] + except IndexError: + logging.warning("Index is not embedded in div0, but div1 ") + parent_div = section.xpath("./ancestor::div1")[0] + parent_div.append(section) +# def make_indices_child_of_div0 ends here ############################################################## # Preparing the Bibliography # @@ -1817,21 +1832,6 @@ def add_bibliography_to_xml( # do_something_funny_about_indices() -def make_indices_child_of_div0(): - """Move index commands to a higher location""" - - index_sections = xmlTree.xpath(" .//EOAprintpersonindex | .//EOAprintlocationindex | .//EOAprintindex") - logging.debug(f"Found {libeoaconvert.plural(len(index_sections), 'index section')}.") - - if index_sections: - for section in index_sections: - try: - parent_div = section.xpath("./ancestor::div0")[0] - except IndexError: - logging.warning("Index is not embedded in div0, but div1 ") - parent_div = section.xpath("./ancestor::div1")[0] - parent_div.append(section) - libeoaconvert.debug_xml_here( xmlTree, "indexmover", DEBUG_DIR) make_indices_child_of_div0()