sense id support

This commit is contained in:
matic_t 2020-10-12 01:27:36 -07:00
parent 300f90822c
commit a0758f5c11
2 changed files with 5 additions and 0 deletions

View File

@ -114,6 +114,9 @@ def export_sense(doc, sense):
sense_xml = doc.createElement("sense")
sense_xml.appendChild(_export_label_list(doc, sense.labels))
if sense.id is not None:
sense_xml.setAttribute("id", sense.id)
definition_list = doc.createElement("definitionList")
sense_xml.appendChild(definition_list)

View File

@ -11,6 +11,7 @@ from view.utils import clean_label
class Sense(Data):
def __init__(self):
self.original_idx = -1
self.id = None
self.definition = {}
self.labels = []
self.translations = []
@ -18,6 +19,7 @@ class Sense(Data):
def import_xml(self, sense_xml, idx):
self.original_idx = idx
self.id = sense_xml.getAttribute("id") if sense_xml.hasAttribute("id") else None
for definition in sense_xml.querySelectorAll("definitionList definition"):
key = definition.getAttribute("type")