diff --git a/src/export.py b/src/export.py index f07ee20..b4f99cd 100644 --- a/src/export.py +++ b/src/export.py @@ -26,6 +26,8 @@ def export_entry(entry): headword_lemma.textContent = entry.headword if entry.headword_type is not None: headword_lemma.setAttribute("type", entry.headword_type) + if entry.headword_audio is not None: + headword_lemma.setAttribute("audio", entry.headword_audio) headword.appendChild(headword_lemma) head.appendChild(headword) @@ -146,6 +148,9 @@ def export_translation(doc, translation): actual_t.textContent = translation.translation actual_t.setAttribute("targetLang", translation.targetLang) + if translation.audio: + actual_t.setAttribute("audio", translation.audio) + if translation.source: actual_t.setAttribute("source", translation.source) translation_xml.appendChild(actual_t) diff --git a/src/model/entry.py b/src/model/entry.py index 46dc5f4..6f305e1 100644 --- a/src/model/entry.py +++ b/src/model/entry.py @@ -14,6 +14,7 @@ class Entry(Data): self.headword = "" self.homonymy = [] self.headword_type = None + self.headword_audio = None self.grammar = "" self.comment = "" self.variants = [] @@ -31,7 +32,8 @@ class Entry(Data): comment = entry_xml.querySelector("head comment") self.status = status.textContent if status else "" self.headword = headword.textContent if headword else "" - self.headword_type = headword.getAttribute("type") if headword else None + self.headword_type = headword.getAttribute("type") if .hasAttribute("type") else None + self.headword_audio = headword.getAttribute("audio") if headword.hasAttribute("audio") else None self.grammar = grammar.textContent if grammar else "" self.comment = comment.textContent if comment else "" self.variants = [v.textContent for v in entry_xml.querySelectorAll("head variantList variant")] diff --git a/src/model/translation.py b/src/model/translation.py index 31e33ee..6bf94bd 100644 --- a/src/model/translation.py +++ b/src/model/translation.py @@ -33,6 +33,7 @@ class Translation(Data): self.translation = "" self.source = "" self.targetLang = "" + self.audio = "" self.explanation = "" self.explanationList = [] self.tags = [] @@ -44,6 +45,7 @@ class Translation(Data): self.translation = translation.textContent self.source = translation.getAttribute("source") if translation.hasAttribute("source") else "" self.targetLang = translation.getAttribute("targetLang") if translation.hasAttribute("targetLang") else "" + self.audio = translation.getAttribute("audio") if translation.hasAttribute("audio") else "" explanationList = translation_xml.querySelectorAll("explanationList explanation")