Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Function for writing appinfo entry
  • Loading branch information
Klaus Thoden committed Nov 28, 2018
1 parent da129c1 commit 7d41c81
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
6 changes: 1 addition & 5 deletions fix_tei.py
Expand Up @@ -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") eoadevteam = etree.SubElement(project_desc, "p", n="eoadevteam").text = BOILERPLATES.get("Header","eoadevteam")
encoding_desc.insert(0, project_desc) encoding_desc.insert(0, project_desc)


appinfo = encoding_desc.find("t:appInfo", namespaces=NS_MAP) libeoaconvert.write_appinfo(xml_tree, "fix_tei", __version__, "fixtei", "Fix TEI for EOA", datetime.now().strftime("%Y-%m-%d"))
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)


revision_desc = xml_tree.xpath("//t:revisionDesc", namespaces=NS_MAP)[0] revision_desc = xml_tree.xpath("//t:revisionDesc", namespaces=NS_MAP)[0]
olderchanges = revision_desc.find("t:listChange", namespaces=NS_MAP) olderchanges = revision_desc.find("t:listChange", namespaces=NS_MAP)
Expand Down
12 changes: 12 additions & 0 deletions libeoaconvert.py
Expand Up @@ -372,3 +372,15 @@ def assign_xml_id(element, identifier):


return return
# def assign_xml_id ends here # 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.