sense id support
This commit is contained in:
parent
300f90822c
commit
a0758f5c11
|
@ -114,6 +114,9 @@ def export_sense(doc, sense):
|
||||||
sense_xml = doc.createElement("sense")
|
sense_xml = doc.createElement("sense")
|
||||||
sense_xml.appendChild(_export_label_list(doc, sense.labels))
|
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")
|
definition_list = doc.createElement("definitionList")
|
||||||
sense_xml.appendChild(definition_list)
|
sense_xml.appendChild(definition_list)
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,7 @@ from view.utils import clean_label
|
||||||
class Sense(Data):
|
class Sense(Data):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.original_idx = -1
|
self.original_idx = -1
|
||||||
|
self.id = None
|
||||||
self.definition = {}
|
self.definition = {}
|
||||||
self.labels = []
|
self.labels = []
|
||||||
self.translations = []
|
self.translations = []
|
||||||
|
@ -18,6 +19,7 @@ class Sense(Data):
|
||||||
|
|
||||||
def import_xml(self, sense_xml, idx):
|
def import_xml(self, sense_xml, idx):
|
||||||
self.original_idx = 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"):
|
for definition in sense_xml.querySelectorAll("definitionList definition"):
|
||||||
key = definition.getAttribute("type")
|
key = definition.getAttribute("type")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user