Added support for name attribute

This commit is contained in:
matic_t
2020-07-16 01:31:16 -07:00
parent a22490c0fc
commit 6f9142b046
4 changed files with 46 additions and 30 deletions

View File

@@ -36,7 +36,7 @@ class Entry(Data):
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.homonymy = [v.textContent for v in entry_xml.querySelectorAll("head headword homonymy homonymyFeature ")]
self.homonymy = [{"value": v.textContent, "name": v.getAttribute("name")} for v in entry_xml.querySelectorAll("head headword homonymy homonymyFeature ")]
self.related_entries = [re.textContent for re in entry_xml.querySelectorAll("head relatedEntryList relatedEntry")]
lex_unit = entry_xml.querySelector("lexical_unit lexeme,lexicalUnit lexeme")
@@ -97,7 +97,8 @@ class Entry(Data):
if len(self.homonymy) == 0:
view_buttons.append(buttons[4])
else:
view_table.append((buttons[4], ", ".join(self.homonymy)))
console.log(self.homonymy)
view_table.append((buttons[4], ", ".join(h.value for h in self.homonymy)))
if len(self.related_entries) == 0:
view_buttons.append(buttons[1])