diff --git a/res/main.html b/res/main.html index 2aa18b5..e0be51f 100644 --- a/res/main.html +++ b/res/main.html @@ -35,9 +35,9 @@ var entry = {"content": ` preizkus explainme! - - podrocjebiologija - + + + @@ -48,9 +48,9 @@ var entry = {"content": ` sdfsd - - podrocjeozboltologija - + + + fsd diff --git a/src/model/translation.py b/src/model/translation.py index 1895951..456aa21 100644 --- a/src/model/translation.py +++ b/src/model/translation.py @@ -13,16 +13,19 @@ class Translation(Editable): def __init__(self, translation_xml): translation = translation_xml.querySelector("translation") self.translation = translation.textContent if translation else "" - self.source = translation.getAttribute("source") or "" + self.source = translation.getAttribute("source") if translation else "" explanation = translation_xml.querySelector("explanation") self.explanation = explanation.textContent if explanation else "" - self.tags = {} - for tag_xml in translation_xml.querySelectorAll("tagsContainer tag"): - t_type = tag_xml.querySelector("type").textContent - t_value = tag_xml.querySelector("value").textContent - self.tags[t_type] = t_value - - + self.tags = [] + for tag_xml in translation_xml.querySelectorAll("labelList label"): + t_type = tag_xml.getAttribute("type") + t_value = tag_xml.textContent + + if t_type not in TAGS: + console.log("Bad tag: ({})->({})".format(t_type, t_value)) + continue + + self.tags.append((t_type, t_value))