[NoJS] reimplementing js features without the js

This commit is contained in:
2026-08-10 16:19:59 +02:00
parent 904ed7e317
commit db60f55c73
7 changed files with 116 additions and 109 deletions
+10 -3
View File
@@ -31,7 +31,7 @@ PAGES = [
def buildPage(
filename: str, pageTitle: str, pageHtml: str, pageStyle: str, template: str
filename: str, pageTitle: str, pageHtml: str, pageStyle: str, template: str, lang: str
) -> str:
template = template.replace("<!--TITLE-->", pageTitle)
style = (
@@ -42,6 +42,13 @@ def buildPage(
template = template.replace("<!--ADDITIONAL_STYLE-->", style)
template = template.replace("PAGE_NAME", filename)
template = template.replace("<!--MAIN-->", pageHtml)
# Fix language switcher links
if lang == "en":
template = template.replace('href="/PAGE_NAME"', f'href="/en/{filename}"')
else:
template = template.replace('href="/en/PAGE_NAME"', f'href="/sr/{filename}"')
return template
@@ -57,7 +64,7 @@ def main():
pageHtml = "<div class='cover-wrap'><img src='/img/students_bug.jpg' alt='Studenti su nasli bug' /></div>"
pageHtml += f.read()
html = buildPage(
page["name"], page["titleSR"], pageHtml, page["style"], templateSR
page["name"], page["titleSR"], pageHtml, page["style"], templateSR, "sr"
)
f = open(f'site/{page["name"]}.html', "w")
f.write(html)
@@ -66,7 +73,7 @@ def main():
pageHtml = "<div class='cover-wrap'><img src='/img/students_bug.jpg' alt='Students found the bug' /></div>"
pageHtml += f.read()
html = buildPage(
page["name"], page["titleEN"], pageHtml, page["style"], templateEN
page["name"], page["titleEN"], pageHtml, page["style"], templateEN, "en"
)
f = open(f'site/en/{page["name"]}.html', "w")
f.write(html)