forked from PrivateCoffee/wikimore
fix: correctly handle 'ku-arab' script direction in articles
Addressed an edge case where articles with the 'ku-arab' variant were displayed in left-to-right (LTR) direction despite being in Arabic script. Added logic to force right-to-left (RTL) direction for such cases, ensuring correct display. Resolves issue with incorrect article formatting.
This commit is contained in:
parent
4dfbd002f6
commit
04e3828f7e
1 changed files with 9 additions and 1 deletions
|
@ -241,11 +241,19 @@ def wiki_article(project, lang, title):
|
|||
li.decompose()
|
||||
|
||||
processed_html = str(body)
|
||||
|
||||
rtl = bool(soup.find("div", class_="mw-parser-output", dir="rtl"))
|
||||
|
||||
# Edge case: When passing the `ku-arab` variant, the article is in Arabic
|
||||
# script but the direction returned in the API response is still LTR.
|
||||
if request.args.get("variant") == "ku-arab":
|
||||
rtl = True
|
||||
|
||||
return render_template(
|
||||
"article.html",
|
||||
title=title.replace("_", " "),
|
||||
content=processed_html,
|
||||
rtl=bool(soup.find("div", class_="mw-parser-output", dir="rtl")),
|
||||
rtl=rtl,
|
||||
)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue