From 84b7026e354d035be2062f83f338c145bc8ad6d3 Mon Sep 17 00:00:00 2001 From: kthoden Date: Wed, 29 Apr 2020 17:07:12 +0200 Subject: [PATCH] Adding feature for parallel text in EOATeX --- src/eoatex2imxml.py | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/eoatex2imxml.py b/src/eoatex2imxml.py index 6b78a57..784079a 100755 --- a/src/eoatex2imxml.py +++ b/src/eoatex2imxml.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 # -*- coding: utf-8; mode: python -*- -# Time-stamp: <2020-04-08 19:03:16 (kthoden)> +# Time-stamp: <2020-04-29 13:30:07 (kthoden)> """ Converts Latex files into a customized DocBook XML file. @@ -1069,6 +1069,24 @@ def process_references(xmlTree): pass # def process_references ends here + +def process_pararefs(xmlTree): + """Write parallel text information into paragraph tag.""" + + pararefs = xmlTree.xpath("//EOApararef") + for pararef in pararefs: + pararef_attributes = pararef.attrib + para_parent = pararef.xpath("./ancestor::p")[0] + # this shortcut does not seem to work + # libeoaconvert.transfer_xml_attributes(pararef, para_parent) + for attrib in pararef_attributes: + print(attrib) + para_parent.attrib[attrib] = pararef_attributes[attrib] + + pararef.tag = "elementtobestripped" +# def process_pararefs ends here + + ############################################################## # Preparing the Bibliography # ############################################################## @@ -1294,6 +1312,7 @@ def add_bibliography_to_xml( process_references(xmlTree) +process_pararefs(xmlTree) xmlChapters = xmlTree.findall("//div1")