|
|
|
@ -9,6 +9,7 @@ def export_to_xml(model):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def export_entry(entry):
|
|
|
|
|
console.log(entry)
|
|
|
|
|
parser = __new__(DOMParser())
|
|
|
|
|
doc = parser.parseFromString("<entry />", "text/xml")
|
|
|
|
|
entry_xml = doc.firstChild
|
|
|
|
@ -23,6 +24,9 @@ def export_entry(entry):
|
|
|
|
|
|
|
|
|
|
headword = doc.createElement("headword")
|
|
|
|
|
headword_lemma = doc.createElement("lemma")
|
|
|
|
|
|
|
|
|
|
# headword_lemma = entry.original_xml.querySelector("head headword lemma")
|
|
|
|
|
|
|
|
|
|
headword_lemma.textContent = entry.headword
|
|
|
|
|
if entry.headword_type is not None:
|
|
|
|
|
headword_lemma.setAttribute("type", entry.headword_type)
|
|
|
|
@ -54,11 +58,21 @@ def export_entry(entry):
|
|
|
|
|
lexunit.appendChild(lexeme)
|
|
|
|
|
head.appendChild(lexunit)
|
|
|
|
|
|
|
|
|
|
grammar = doc.createElement("grammar")
|
|
|
|
|
grammar_category = doc.createElement("category")
|
|
|
|
|
grammar_category = entry.original_xml.querySelector("head grammar category")
|
|
|
|
|
if grammar_category is None:
|
|
|
|
|
grammar = doc.createElement("grammar")
|
|
|
|
|
grammar_category = doc.createElement("category")
|
|
|
|
|
grammar.appendChild(grammar_category)
|
|
|
|
|
entry.original_xml.querySelector("head").appendChild(grammar_category)
|
|
|
|
|
|
|
|
|
|
grammar_category.textContent = entry.grammar
|
|
|
|
|
grammar.appendChild(grammar_category)
|
|
|
|
|
head.appendChild(grammar)
|
|
|
|
|
|
|
|
|
|
head.appendChild(entry.original_xml.querySelector("head grammar"))
|
|
|
|
|
# if (grammar_category)
|
|
|
|
|
|
|
|
|
|
# entry.original_xml.querySelector("head grammar category").textContent
|
|
|
|
|
# grammar.appendChild(grammar_category)
|
|
|
|
|
# head.appendChild(grammar)
|
|
|
|
|
|
|
|
|
|
if len(entry.measure) > 0:
|
|
|
|
|
measure_list = doc.createElement("measureList")
|
|
|
|
|