Permalink
Browse files

Function for writing appinfo entry

  • Loading branch information...
kthoden committed Nov 28, 2018
1 parent da129c1 commit 7d41c81442ba871f8128e7a298dfd58e117d9807
Showing with 13 additions and 5 deletions.
  1. +1 −5 fix_tei.py
  2. +12 −0 libeoaconvert.py
@@ -478,11 +478,7 @@ 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)

appinfo = encoding_desc.find("t:appInfo", namespaces=NS_MAP)
fix_tei_info = etree.Element("application", ident="fix_tei", version=__version__)
fix_tei_info.attrib["{http://www.w3.org/XML/1998/namespace}id"] = "fixtei"
fix_tei_label = etree.SubElement(fix_tei_info, "label").text = "Fix TEI for EOA"
appinfo.insert(-1, fix_tei_info)
libeoaconvert.write_appinfo(xml_tree, "fix_tei", __version__, "fixtei", "Fix TEI for EOA", datetime.now().strftime("%Y-%m-%d"))

revision_desc = xml_tree.xpath("//t:revisionDesc", namespaces=NS_MAP)[0]
olderchanges = revision_desc.find("t:listChange", namespaces=NS_MAP)
@@ -372,3 +372,15 @@ def assign_xml_id(element, identifier):

return
# def assign_xml_id ends here

def write_appinfo(xml_tree, 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",})
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

0 comments on commit 7d41c81

Please sign in to comment.