Skip to content

Commit

Permalink
Index and math: ongoing work
Browse files Browse the repository at this point in the history
  • Loading branch information
kthoden committed Mar 3, 2020
1 parent 55447a3 commit 81d68d3
Showing 1 changed file with 54 additions and 0 deletions.
54 changes: 54 additions & 0 deletions src/tei2imxml.py
Original file line number Diff line number Diff line change
Expand Up @@ -1082,6 +1082,60 @@ def handle_refs_default(ref):
for ref in eoa_ref:
handle_refs_default(ref)

############
# Indexing #
############
# indexName="person"><term corresp="https://www.wikidata.org/wiki/Q6882">James Joyce</term></index>"
index_entries = xml_tree.xpath("//t:body//t:index", namespaces=NS_MAP)
for entry in index_entries:
# hier weiter!
pass

########
# Math #
########

# <EOAineq src="EOAineq_7_1.png" TeX="\sqrt{9} = 3"/>
inline_equations = xml_tree.xpath("//t:body//t:formula[@rend='inline' and @notation='tex']", namespaces=NS_MAP)
for equation in inline_equations:
tex_formula = equation.text
formula_tail = equation.tail
equation.clear()
equation.tag = "EOAineq"
equation.set("TeX", tex_formula)
png_file = "oh dear"
equation.set("src", png_file)
equation.tail = formula_tail

block_equations = xml_tree.xpath("//t:body//t:ab[@type='equation']", namespaces=NS_MAP)
for equation in block_equations:
# take care of nonumber, as well
equation.tag = "ACHTUNGstillsomeworktodo"

sub_equations = xml_tree.xpath("//t:body//t:ab[@type='subequations']", namespaces=NS_MAP)
for equation in sub_equations:
# take care of nonumber, as well
equation.tag = "ACHTUNGstillsomeworktodo"
pass

equationarrays = xml_tree.xpath("//t:body//t:ab[@type='equationarray']", namespaces=NS_MAP)
for equation in equationarrays:
# take care of nonumber, as well
equation.tag = "ACHTUNGstillsomeworktodo"
pass

# <ab type="theoremdeclaration" xml:id="theorem1">My Theorem</ab>
# <ab type="theoreminstance" corresp="#theorem1">A statement.</ab>
# theorems =

#############
# Chemistry #
#############
# <formula notation="mhchem" rend="inline">2HCO3^- + Ca^2+ &lt;=&gt; CaCO3 + CO2 + H2O</formula>
inline_chemo = xml_tree.xpath("//t:body//t:formula[@rend='inline' and @notation='mhchem']", namespaces=NS_MAP)
for chem in inline_chemo:
pass

return xml_tree
# def transform_body ends here

Expand Down

0 comments on commit 81d68d3

Please sign in to comment.