From 6671fb1547b4cd5adfd4b3c5628a77cc0d542c49 Mon Sep 17 00:00:00 2001 From: Hugo Date: Tue, 29 Aug 2023 15:25:20 +0200 Subject: [PATCH] Implement page builder for English --- .gitignore | 1 + build_pages.py | 11 +++++++++-- prep.py | 3 --- site/styles/style.css | 6 +----- template/page-en.html | 12 +++++++----- template/page-sr.html | 4 +++- 6 files changed, 21 insertions(+), 16 deletions(-) diff --git a/.gitignore b/.gitignore index 86197ef..09d3036 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ venv/ site/*.html +site/en/*.html site/atom_blog.xml site/atom_events.xml poster.html diff --git a/build_pages.py b/build_pages.py index d82a109..edda7fd 100644 --- a/build_pages.py +++ b/build_pages.py @@ -9,10 +9,11 @@ PAGES = [ {'name': 'webring', 'titleSR': 'Webring', 'titleEN': 'Webring', 'style': ''}, ] -def buildPage(pageTitle: str, pageHtml: str, pageStyle: str, template: str) -> str: +def buildPage(filename: str, pageTitle: str, pageHtml: str, pageStyle: str, template: str) -> str: template = template.replace('', pageTitle) style = '' if not pageStyle else f'' template = template.replace('', style) + template = template.replace('PAGE_NAME', filename) template = template.replace('', pageHtml) return template @@ -24,10 +25,16 @@ def main(): for page in PAGES: with open(f'pages/sr/{page["name"]}.html') as f: pageHtml = f.read() - html = buildPage(page['titleSR'], pageHtml, page['style'], templateSR) + html = buildPage(page['name'], page['titleSR'], pageHtml, page['style'], templateSR) f = open(f'site/{page["name"]}.html', 'w') f.write(html) f.close() + with open(f'pages/en/{page["name"]}.html') as f: + pageHtml = f.read() + html = buildPage(page['name'], page['titleEN'], pageHtml, page['style'], templateEN) + f = open(f'site/en/{page["name"]}.html', 'w') + f.write(html) + f.close() if __name__ == '__main__': main() \ No newline at end of file diff --git a/prep.py b/prep.py index 4a41c98..0d12672 100644 --- a/prep.py +++ b/prep.py @@ -77,10 +77,7 @@ events = load_events() events = sort_events(events) write_events(events) -print(events) - newevents = build_html(events, DAYS_SR, MONTHS_SR) -print(newevents) with open("pages/sr/events.html","wt") as file: file.writelines(["

Događaji

\n", "\n", "\n"]) diff --git a/site/styles/style.css b/site/styles/style.css index 25a9752..cbd8559 100644 --- a/site/styles/style.css +++ b/site/styles/style.css @@ -111,7 +111,7 @@ a:focus { background: linear-gradient(90deg, var(--hightlight) 0%, var(--hightlight) 50%, var(--bg) 51%, var(--bg) 100%); } -.account { +.lang { font-size: 2rem; } @@ -210,8 +210,4 @@ screen and (max-width: 1500px) { #theme-switcher { margin-right: 1rem; } - - .account { - font-size: 1rem; - } } \ No newline at end of file diff --git a/template/page-en.html b/template/page-en.html index 843fb18..330afa7 100644 --- a/template/page-en.html +++ b/template/page-en.html @@ -9,12 +9,13 @@ <!--TITLE--> Decentrala +
- + - + SR
@@ -22,9 +23,10 @@
DatumVremeMestoTema