Skip to content

Commit

Permalink
wiktextract: move Categories to the bottom of entry
Browse files Browse the repository at this point in the history
  • Loading branch information
ilius committed Dec 17, 2024
1 parent b8b0a44 commit 26f13ed
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions pyglossary/plugins/wiktextract.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,9 @@ def br() -> Element:
with hf.element("font", color=self._gram_color):
hf.write(pos)

self.writeSenseList(hf_, data.get("senses")) # type: ignore
senses = data.get("senses") or []

self.writeSenseList(hf_, senses) # type: ignore

self.writeSynonyms(hf_, data.get("synonyms")) # type: ignore

Expand All @@ -232,6 +234,13 @@ def br() -> Element:
with hf.element("div"):
hf.write(f"Etymology: {etymology}")

categories = []
for sense in senses:
senseCats = sense.get("categories")
if senseCats:
categories += senseCats
self.writeSenseCategories(hf_, categories)

defi = f.getvalue().decode("utf-8")
# defi = defi.replace("\xa0", " ") # do we need to do this?
file = self._file
Expand Down Expand Up @@ -645,8 +654,6 @@ def writeSense(
if glosses:
self.makeList(hf, glosses, self.writeSenseGloss)

self.writeSenseCategories(hf, sense.get("categories"))

self.writeTopics(hf, sense.get("topics"))

self.writeSenseFormOfList(hf, sense.get("form_of"))
Expand Down

0 comments on commit 26f13ed

Please sign in to comment.