Adding variants and labels to entry, not yet done.

This commit is contained in:
2019-11-18 20:27:11 +01:00
parent a058a50017
commit 4bdb3bfc7f
8 changed files with 68 additions and 19 deletions

View File

@@ -12,6 +12,18 @@ class Entry(Editable):
self.headword = headword.textContent if headword else ""
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")]
self.labels = []
for tag_xml in entry_xml.querySelectorAll("head labelList label"):
t_type = tag_xml.getAttribute("type")
t_value = tag_xml.textContent
if t_type not in TAGS:
# using some default
t_type = TAGS.keys()[0]
self.labels.append((t_type, t_value))
self.senses = [Sense(sense_xml) for sense_xml in
entry_xml.querySelectorAll("body senseList sense")]