New example import/export.
This commit is contained in:
parent
38fe7a5740
commit
dcb4840f2a
|
@ -111,9 +111,7 @@ def export_sense(doc, sense):
|
|||
example_container = doc.createElement("exampleContainer")
|
||||
example_container_list.appendChild(example_container)
|
||||
|
||||
example_xml = doc.createElement("example")
|
||||
example_xml.textContent = example.example
|
||||
example_container.appendChild(example_xml)
|
||||
example_container.appendChild(example.original_xml)
|
||||
|
||||
translation_container = doc.createElement("translationContainer")
|
||||
example_container.appendChild(translation_container)
|
||||
|
|
|
@ -2,8 +2,19 @@ from model.editable import Editable
|
|||
|
||||
class Example(Editable):
|
||||
def __init__(self, example_xml):
|
||||
example = example_xml.querySelector("example")
|
||||
self.example = example.textContent if example else ""
|
||||
# example = example_xml.querySelector("example")
|
||||
# self.example = example.textContent if example else ""
|
||||
|
||||
ce_xml = example_xml.querySelector("corpusExample")
|
||||
if ce_xml is not None:
|
||||
self.example_type = "corpus"
|
||||
inner_xml = ce_xml
|
||||
else:
|
||||
self.example_type = "multiword"
|
||||
inner_xml = example_xml.querySelector("multiwordExample")
|
||||
|
||||
self.original_xml = inner_xml
|
||||
self.text = inner_xml.textContent
|
||||
|
||||
self.translations = []
|
||||
for translation in example_xml.querySelectorAll("translationContainer translation"):
|
||||
|
|
|
@ -100,7 +100,7 @@ class View:
|
|||
return h("div.example", {}, [
|
||||
h("div.example-dot", {}, "▣"),
|
||||
h(example_tag, {}, [
|
||||
h("span.example-text", {"on": {"click": msg(ShowExampleEdit(example))} }, example.example),
|
||||
h("span.example-text", {"on": {"click": msg(ShowExampleEdit(example))} }, example.text),
|
||||
h("div.example-translation-list", { "on": {"click": msg(ShowExampleTranslationEdit(example))} }, [
|
||||
h("div.example-translation", {}, [
|
||||
h("span.example-arrow", {}, "↪"),
|
||||
|
|
Loading…
Reference in New Issue
Block a user