mt-additional-xml-shema-support #5
|
@ -32,10 +32,11 @@ def export_entry(entry):
|
|||
homonymy = doc.createElement("homonymy")
|
||||
headword.appendChild(homonymy)
|
||||
|
||||
for h in entry.homonymy:
|
||||
for hFeature in entry.homonymy:
|
||||
feature = doc.createElement("homonymyFeature")
|
||||
feature.textContent = h.value
|
||||
feature.setAttribute("name", h["name"])
|
||||
feature.textContent = hFeature.value
|
||||
# Can't use hFeature.name, because Python has name reserver and so it becomes py_name in JS
|
||||
feature.setAttribute("name", hFeature["name"])
|
||||
homonymy.appendChild(feature)
|
||||
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@ def generic_list_getter():
|
|||
result.append(result_candidate)
|
||||
return result
|
||||
|
||||
# Formats data from inputs to name-value objects
|
||||
def homonymy_list_getter():
|
||||
result = []
|
||||
for row in document.getElementsByClassName("label-list-row"):
|
||||
|
|
|
@ -96,7 +96,7 @@ class Entry(Data):
|
|||
if len(self.homonymy) == 0:
|
||||
view_buttons.append(buttons[4])
|
||||
else:
|
||||
view_table.append((buttons[4], ", ".join(h.value for h in self.homonymy)))
|
||||
view_table.append((buttons[4], ", ".join((h["name"] + ": " + h.value) for h in self.homonymy)))
|
||||
|
||||
if len(self.related_entries) == 0:
|
||||
view_buttons.append(buttons[1])
|
||||
|
|
|
@ -55,12 +55,13 @@ def homonymy_editor(title, current_labels):
|
|||
|
||||
content = [h("p", {}, title)]
|
||||
for i, feature in enumerate(current_labels()):
|
||||
name = [h("div")]
|
||||
value = [h("div")]
|
||||
name = []
|
||||
value = []
|
||||
name.append(h("label", {"attrs": {"for": i}}, "Name:"))
|
||||
name.append(h("input.name-input", {"props": {"type": "text", "value": feature["name"], "id": i}}, ""))
|
||||
value.append(h("label", {"attrs": {"for": i + "-value"}}, "Value:"))
|
||||
value.append(h("input.value-input", {"props": {"type": "text", "value": feature["value"], "id": i + "-value"}}, ""))
|
||||
|
||||
content.append(split_line2(name, value))
|
||||
content.append(h("button", {"on": {"click": message.msg(message.AddToGenericList, current_labels)}}, "+"))
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user