Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Rewriting appinfo
  • Loading branch information
kthoden committed Jan 3, 2019
1 parent 53e87c4 commit 47ef00e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
4 changes: 3 additions & 1 deletion fix_tei.py
Expand Up @@ -492,7 +492,9 @@ def fix_tei_header(xml_tree, bibfile_string, bibtype):
eoadevteam = etree.SubElement(project_desc, "p", n="eoadevteam").text = BOILERPLATES.get("Header","eoadevteam")
encoding_desc.insert(0, project_desc)

libeoaconvert.write_appinfo(xml_tree, "fix_tei", __version__, "fixtei", "Fix TEI for EOA", datetime.now().strftime("%Y-%m-%d"))
appinfo = xml_tree.xpath("//t:encodingDesc/t:appInfo", namespaces=NS_MAP)[0]
fix_tei_info = libeoaconvert.get_appinfo("fix_tei", __version__, "fixtei", "Fix TEI for EOA", datetime.now().strftime("%Y-%m-%d"))
appinfo.insert(0, fix_tei_info)

revision_desc = xml_tree.xpath("//t:revisionDesc", namespaces=NS_MAP)[0]
olderchanges = revision_desc.find("t:listChange", namespaces=NS_MAP)
Expand Down
9 changes: 4 additions & 5 deletions libeoaconvert.py
Expand Up @@ -373,14 +373,13 @@ def assign_xml_id(element, identifier):
return
# def assign_xml_id ends here

def write_appinfo(xml_tree, ident, version, xmlid, text, date):
def get_appinfo(ident, version, xmlid, text, date):
"""Log the change of a TEI document in the appinfo element"""

appinfo = xml_tree.find("//t:encodingDesc/t:appInfo", namespaces={"t": "http://www.tei-c.org/ns/1.0",})
logging.info("Writing appinfo")
fix_tei_info = etree.Element("application", ident=ident, version=version, when=date)
fix_tei_info.attrib["{http://www.w3.org/XML/1998/namespace}id"] = xmlid
fix_tei_label = etree.SubElement(fix_tei_info, "label").text = text
appinfo.insert(0, fix_tei_info)

return
# def write_appinfo ends here
return fix_tei_info
# def get_appinfo ends here

0 comments on commit 47ef00e

Please sign in to comment.