mt-homonymy-support #2

Manually merged
lexonomy merged 7 commits from mt-homonymy-support into master 2020-08-05 10:04:56 +00:00
4 changed files with 9 additions and 6 deletions
Showing only changes of commit 9c007f6dd6 - Show all commits

View File

@ -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)

View File

@ -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"):

View File

@ -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])

View File

@ -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)}}, "+"))