Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Handle parts so they are recognized by next scripts
  • Loading branch information
kthoden committed Jan 15, 2020
1 parent a212e1f commit 4ae7afb
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/tei2imxml.py
Expand Up @@ -614,6 +614,13 @@ def handle_refs_default(ref):
else:
logging.warning("Found a processing instruction without parent!")

eoa_parts = xml_tree.xpath("//t:div[@type='part']", namespaces=NS_MAP)
for part in eoa_parts:
part.tag = "div0"
xml_id = part.attrib["{http://www.w3.org/XML/1998/namespace}id"]
del part.attrib["{http://www.w3.org/XML/1998/namespace}id"]
part.set("id", xml_id)

eoa_chapters = xml_tree.xpath("//t:div[@type='chapter']", namespaces=NS_MAP)
for chapter in eoa_chapters:
chapter.tag = "div1"
Expand Down

0 comments on commit 4ae7afb

Please sign in to comment.