feat: enhance category links display and functionality

Transformed specific 'link' elements into anchor tags with improved styling
for better readability and usability. Added CSS styling for category links
to ensure they are displayed inline with appropriate spacing, improving
the user experience.
This commit is contained in:
Kumi 2024-08-19 19:00:43 +02:00
parent f1b5b81050
commit f91ccba437
Signed by: kumi
GPG key ID: ECBCC9082395383F
2 changed files with 11 additions and 0 deletions

View file

@ -315,6 +315,11 @@ def wiki_article(
for video in soup.find_all("video"):
video["poster"] = get_proxy_url(video["poster"])
for link in soup.find_all("link", rel="mw:PageProp/Category"):
link.name = "a"
link.string = link["href"][2:].replace("_", " ")
link["class"] = "category-link"
for li in soup.find_all("li"):
if any(cls in li.get("class", []) for cls in ["nv-view", "nv-talk", "nv-edit"]):
li.decompose()

View file

@ -206,6 +206,12 @@ h1 {
text-align: center;
}
.category-link {
display: inline;
margin-right: 5px;
font-size: 0.8em;
}
/* General table styling */
.table {
margin: 1em auto;