Skip to content

Commit

Permalink
Print index instruction
Browse files Browse the repository at this point in the history
  • Loading branch information
kthoden committed Mar 4, 2020
1 parent 52d087b commit 36db9ee
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/tei2imxml.py
Original file line number Diff line number Diff line change
Expand Up @@ -773,6 +773,14 @@ def handle_refs_default(ref):

latex_pis = xml_tree.xpath("//processing-instruction('latex')")
for latex_pi in latex_pis:
indices = ["\EOAprintindex", "\EOAprintpersonindex", "\EOAprintlocationonindex"]
if latex_pi.text in indices:
parent_element = latex_pi.getparent()
index_command = latex_pi.text[1:]
parent_element.append(etree.Element(index_command))
else:
pass

if latex_pi.getparent() is not None:
etree.strip_tags(latex_pi.getparent(), latex_pi.tag)
else:
Expand Down Expand Up @@ -1213,10 +1221,8 @@ def handle_refs_default(ref):
entry_content = entry.find("t:term", namespaces=NS_MAP)
try:
sortkey = entry_content.get("sortKey")
print("sortkey found")
except AttributeError:
sortkey = ""
print("no sortkey")
entry_text = ""
if len(sortkey) > 0:
entry_text = f"{sortkey}@"
Expand Down

0 comments on commit 36db9ee

Please sign in to comment.