Skip to content

Commit

Permalink
freedict: writeSenseSense: minor refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
ilius committed Dec 15, 2024
1 parent 62d5ff9 commit 58f3cf3
Showing 1 changed file with 16 additions and 18 deletions.
34 changes: 16 additions & 18 deletions pyglossary/plugins/freedict/reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -432,10 +432,9 @@ def writeSenseSense( # noqa: PLR0912
if i > 0:
hf.write(" | ")
self.writeRef(hf, ref)
if ps.xrList:
for xr in ps.xrList:
with hf.element("div"):
self.writeRichText(hf, xr)
for xr in ps.xrList:
with hf.element("div"):
self.writeRichText(hf, xr)
if ps.usgList:
with hf.element("div"):
hf.write("Usage: ")
Expand All @@ -444,21 +443,20 @@ def writeSenseSense( # noqa: PLR0912
if i > 0:
hf.write(self.getCommaSep(text))
hf.write(text)
if ps.exampleCits:
for cit in ps.exampleCits:
with hf.element(
"div",
attrib={
"class": "example",
"style": f"padding: {self._example_padding}px 0px;",
},
):
for quote in cit.findall("quote", NAMESPACE):
for cit in ps.exampleCits:
with hf.element(
"div",
attrib={
"class": "example",
"style": f"padding: {self._example_padding}px 0px;",
},
):
for quote in cit.findall("quote", NAMESPACE):
self.writeWithDirection(hf, quote, "div")
for cit2 in cit.findall("cit", NAMESPACE):
for quote in cit2.findall("quote", NAMESPACE):
quote.attrib.update(cit2.attrib)
self.writeWithDirection(hf, quote, "div")
for cit2 in cit.findall("cit", NAMESPACE):
for quote in cit2.findall("quote", NAMESPACE):
quote.attrib.update(cit2.attrib)
self.writeWithDirection(hf, quote, "div")

return len(ps.transCits) + len(ps.exampleCits)

Expand Down

0 comments on commit 58f3cf3

Please sign in to comment.