Implement page builder for English
This commit is contained in:
parent
221dff13dd
commit
6671fb1547
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,5 +1,6 @@
|
|||||||
venv/
|
venv/
|
||||||
site/*.html
|
site/*.html
|
||||||
|
site/en/*.html
|
||||||
site/atom_blog.xml
|
site/atom_blog.xml
|
||||||
site/atom_events.xml
|
site/atom_events.xml
|
||||||
poster.html
|
poster.html
|
||||||
|
@ -9,10 +9,11 @@ PAGES = [
|
|||||||
{'name': 'webring', 'titleSR': 'Webring', 'titleEN': 'Webring', 'style': ''},
|
{'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('<!--TITLE-->', pageTitle)
|
template = template.replace('<!--TITLE-->', pageTitle)
|
||||||
style = '' if not pageStyle else f'<link rel=\"stylesheet\" href=\"/styles/{pageStyle}.css\">'
|
style = '' if not pageStyle else f'<link rel=\"stylesheet\" href=\"/styles/{pageStyle}.css\">'
|
||||||
template = template.replace('<!--ADDITIONAL_STYLE-->', style)
|
template = template.replace('<!--ADDITIONAL_STYLE-->', style)
|
||||||
|
template = template.replace('PAGE_NAME', filename)
|
||||||
template = template.replace('<!--MAIN-->', pageHtml)
|
template = template.replace('<!--MAIN-->', pageHtml)
|
||||||
return template
|
return template
|
||||||
|
|
||||||
@ -24,10 +25,16 @@ def main():
|
|||||||
for page in PAGES:
|
for page in PAGES:
|
||||||
with open(f'pages/sr/{page["name"]}.html') as f:
|
with open(f'pages/sr/{page["name"]}.html') as f:
|
||||||
pageHtml = f.read()
|
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 = open(f'site/{page["name"]}.html', 'w')
|
||||||
f.write(html)
|
f.write(html)
|
||||||
f.close()
|
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__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
3
prep.py
3
prep.py
@ -77,10 +77,7 @@ events = load_events()
|
|||||||
events = sort_events(events)
|
events = sort_events(events)
|
||||||
write_events(events)
|
write_events(events)
|
||||||
|
|
||||||
print(events)
|
|
||||||
|
|
||||||
newevents = build_html(events, DAYS_SR, MONTHS_SR)
|
newevents = build_html(events, DAYS_SR, MONTHS_SR)
|
||||||
print(newevents)
|
|
||||||
|
|
||||||
with open("pages/sr/events.html","wt") as file:
|
with open("pages/sr/events.html","wt") as file:
|
||||||
file.writelines(["<h1>Događaji</h1>\n", "<table>\n", "<tr><th>Datum</th><th>Vreme</th><th>Mesto</th><th>Tema</th></tr>\n"])
|
file.writelines(["<h1>Događaji</h1>\n", "<table>\n", "<tr><th>Datum</th><th>Vreme</th><th>Mesto</th><th>Tema</th></tr>\n"])
|
||||||
|
@ -111,7 +111,7 @@ a:focus {
|
|||||||
background: linear-gradient(90deg, var(--hightlight) 0%, var(--hightlight) 50%, var(--bg) 51%, var(--bg) 100%);
|
background: linear-gradient(90deg, var(--hightlight) 0%, var(--hightlight) 50%, var(--bg) 51%, var(--bg) 100%);
|
||||||
}
|
}
|
||||||
|
|
||||||
.account {
|
.lang {
|
||||||
font-size: 2rem;
|
font-size: 2rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -210,8 +210,4 @@ screen and (max-width: 1500px) {
|
|||||||
#theme-switcher {
|
#theme-switcher {
|
||||||
margin-right: 1rem;
|
margin-right: 1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.account {
|
|
||||||
font-size: 1rem;
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -9,12 +9,13 @@
|
|||||||
<link rel="shortcut icon" href="/img/favicon.ico" type="image/x-icon">
|
<link rel="shortcut icon" href="/img/favicon.ico" type="image/x-icon">
|
||||||
<script src="/scripts/main.js" defer></script>
|
<script src="/scripts/main.js" defer></script>
|
||||||
<title><!--TITLE--> Decentrala</title>
|
<title><!--TITLE--> Decentrala</title>
|
||||||
|
<link rel="alternate" hreflang="sr" href="/PAGE_NAME" />
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<header>
|
<header>
|
||||||
<a id="logo" href="/"><img src="/img/logo-light.svg" alt="Logo"> Decentrala</a>
|
<a id="logo" href="/en/"><img src="/img/logo-light.svg" alt="Logo"> Decentrala</a>
|
||||||
<button id="theme-switcher"></button>
|
<button id="theme-switcher"></button>
|
||||||
<a class="account" href="/en/account">Account</a>
|
<a class="lang" hreflang="sr" href="/PAGE_NAME">SR</a>
|
||||||
</header>
|
</header>
|
||||||
<main>
|
<main>
|
||||||
<!--MAIN-->
|
<!--MAIN-->
|
||||||
@ -22,9 +23,10 @@
|
|||||||
<footer>
|
<footer>
|
||||||
<button id="sections-button" opened="false"><img src="/img/strelica-closed-light.svg" alt="OpenMenu"></button>
|
<button id="sections-button" opened="false"><img src="/img/strelica-closed-light.svg" alt="OpenMenu"></button>
|
||||||
<nav>
|
<nav>
|
||||||
<a href="/en/events">Događaji</a>
|
<a href="/en/events">Events</a>
|
||||||
<a href="/en/services">Servisi</a>
|
<a href="/en/services">Services</a>
|
||||||
<a href="/en/contact">Kontakt</a>
|
<a href="/en/contact">Contact</a>
|
||||||
|
<a href="/en/account">Account</a>
|
||||||
</nav>
|
</nav>
|
||||||
<span class="links">
|
<span class="links">
|
||||||
<a href="https://creativecommons.org/licenses/by-nc-sa/4.0/"><img src="/img/cc-light.svg" alt="CreativeCommons"></a>
|
<a href="https://creativecommons.org/licenses/by-nc-sa/4.0/"><img src="/img/cc-light.svg" alt="CreativeCommons"></a>
|
||||||
|
@ -9,12 +9,13 @@
|
|||||||
<link rel="shortcut icon" href="/img/favicon.ico" type="image/x-icon">
|
<link rel="shortcut icon" href="/img/favicon.ico" type="image/x-icon">
|
||||||
<script src="/scripts/main.js" defer></script>
|
<script src="/scripts/main.js" defer></script>
|
||||||
<title><!--TITLE--> Decentrala</title>
|
<title><!--TITLE--> Decentrala</title>
|
||||||
|
<link rel="alternate" hreflang="en" href="/en/PAGE_NAME" />
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<header>
|
<header>
|
||||||
<a id="logo" href="/"><img src="/img/logo-light.svg" alt="Logo"> Decentrala</a>
|
<a id="logo" href="/"><img src="/img/logo-light.svg" alt="Logo"> Decentrala</a>
|
||||||
<button id="theme-switcher"></button>
|
<button id="theme-switcher"></button>
|
||||||
<a class="account" href="/account">Nalog</a>
|
<a class="lang" hreflang="en" href="/en/PAGE_NAME">EN</a>
|
||||||
</header>
|
</header>
|
||||||
<main>
|
<main>
|
||||||
<!--MAIN-->
|
<!--MAIN-->
|
||||||
@ -25,6 +26,7 @@
|
|||||||
<a href="/events">Događaji</a>
|
<a href="/events">Događaji</a>
|
||||||
<a href="/services">Servisi</a>
|
<a href="/services">Servisi</a>
|
||||||
<a href="/contact">Kontakt</a>
|
<a href="/contact">Kontakt</a>
|
||||||
|
<a class="account" href="/account">Nalog</a>
|
||||||
</nav>
|
</nav>
|
||||||
<span class="links">
|
<span class="links">
|
||||||
<a href="https://creativecommons.org/licenses/by-nc-sa/4.0/"><img src="/img/cc-light.svg" alt="CreativeCommons"></a>
|
<a href="https://creativecommons.org/licenses/by-nc-sa/4.0/"><img src="/img/cc-light.svg" alt="CreativeCommons"></a>
|
||||||
|
Loading…
Reference in New Issue
Block a user