From 06f0f90bbd97195fd8d43fd9fec7dd65367dbcec Mon Sep 17 00:00:00 2001 From: kthoden Date: Thu, 14 Nov 2019 12:12:18 +0100 Subject: [PATCH] Find index also in div1 --- eoatex2imxml.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/eoatex2imxml.py b/eoatex2imxml.py index 8767b0e..dbad4c4 100755 --- a/eoatex2imxml.py +++ b/eoatex2imxml.py @@ -1706,8 +1706,14 @@ def make_indices_child_of_div0(): if index_sections: for section in index_sections: - parent_div0 = section.xpath("./ancestor::div0")[0] - parent_div0.append(section) + 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() etree.strip_tags(xmlTree, "tagtobestripped")