Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Move function into function definition block
  • Loading branch information
kthoden committed Sep 4, 2020
1 parent d2b4c39 commit 724f9ee
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions src/eoatex2imxml.py
Expand Up @@ -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 #
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit 724f9ee

Please sign in to comment.