Merge pull request 'Implement the English version' (#16) from hugo/website2:english_version into master

Reviewed-on: Decentrala/website#16
This commit is contained in:
hugo 2023-08-30 08:08:51 +00:00
commit 4bcd13a713
13 changed files with 161 additions and 119 deletions

1
.gitignore vendored
View File

@ -1,5 +1,6 @@
venv/
site/*.html
site/en/*.html
site/atom_blog.xml
site/atom_events.xml
poster.html

View File

@ -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('<!--TITLE-->', pageTitle)
style = '' if not pageStyle else f'<link rel=\"stylesheet\" href=\"/styles/{pageStyle}.css\">'
template = template.replace('<!--ADDITIONAL_STYLE-->', style)
template = template.replace('PAGE_NAME', filename)
template = template.replace('<!--MAIN-->', 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()

7
pages/en/account.html Normal file
View File

@ -0,0 +1,7 @@
<p>If you have created an account on dmz.rs, you can use our XMPP and e-mail server, as well as other services that support LDAP login.<p>
<p>For more on XMPP see <a href="https://wiki.dmz.rs/en/tutorial/conversations">this tutorial</a>. <p>
<p>You can see settings for the <a href="https://thunderbird.org">Thundebird</a> mail client on this <a href="/img/mailsettings.png">image</a>.<p>
<p><a href="/account/register/">Register</a><p>
<p><a href="/account/unregister/">Delete account</a><p>
<p><a href="/account/changepassword/">Change password</a><p>

5
pages/en/contact.html Normal file
View File

@ -0,0 +1,5 @@
<h1>Contact</h1>
<p>You can send mail to <a href="mailto:dmz@dmz.rs">dmz@dmz.rs</a> or you can register on <a href="https://forum.dmz.rs">our Forum</a>.</p>
<p>Also, we are available on the <a href="https://balkan.fedive.rs/@decentrala">Fediverse!</a></p>
<br>
<p>If you find a bug on the site, please do tell us. We would be very grateful.</p>

1
pages/en/events.html Normal file
View File

@ -0,0 +1 @@
<h1>Events</h1>

31
pages/en/index.html Normal file
View File

@ -0,0 +1,31 @@
<h1>Welcome!</h1>
<p>
We are <em>Decentrala</em> - a group of enthusiasts gathered around the idea of decentralization and knowledge sharing.
Here are some more facts about us:
</p>
<dl>
<dt>Knowledge:</dt>
<dd>
All our workshops are free and open to everyone.
Also, if you have something to share, feel free to announce the event on the <a href="https://forum.dmz.rs"></a>Forum</a>.
</dd>
<dt>Actions:</dt>
<dd>From time to time we organize actions, hackathons, crypto parties, exhibitions, etc.</dd>
<dt>Services:</dt>
<dd>Our servers run various services (like e-mail, git, wiki, etc...) that are open to everyone.</dd>
<dt>Donations:</dt>
<dd>
Decentrala accepts donations exclusively from persons and without any obligations.
We are independent and we try to keep it that way.
You can donate old hardware (laptops, phones, PC components) to us, and we will find a use for it in Decentrala or give it to people who need it.
Also, you can donate bitcoin and monero by sending to the following addresses:
<p>Bitcoin: bc1qjhsfgq79wuzzv32yml9zglwzf9qcwfj3atuy74</p>
<p>Monero: 8BESz45LnxrgCwZP32KieiN1D4LinCfsS1YjdFHfGXrVCmPs35167QsW1gd7qbff4UAtBbT6oWrkbfZnJm71HornVRiRZFS</p>
</dd>
</dl>
<p>
If you are still interested, you can create an <a href="/en/account">account</a>
on our server which will enable the use of all our <a href="/en/services">services</a>.
If you want to see first how it all looks, you can come to one of our
<a href="/en/events">event</a>, and meet us there!
</p>

54
pages/en/services.html Normal file
View File

@ -0,0 +1,54 @@
<h1>Services</h1>
<table>
<tr>
<th>Service</th>
<th>Description</th>
</tr>
<tr>
<td><a href="/account">E-mail</a></td>
<td>E-mail account that you can use with any e-mail client (for example, with the <a href="https://www.thunderbird.net/">Thunderbird</a>).</td>
</tr>
<tr>
<td><a href="https://forum.dmz.rs/">Forum</a></td>
<td>Forum for general discussion and <a href="/events">event</a> organization.</td>
</tr>
<tr>
<td>Chat</td>
<td>
We have our XMPP server, on which you can make an account.
If you already have an account, you can find us at group <a href="decentrala@conference.dmz.rs">decentrala@conference.dmz.rs</a>.
</td>
</tr>
<tr>
<td><a href="https://gitea.dmz.rs/">Git</a></td>
<td><a href="https://gitea.io/en-us/">Gitea</a> instance on which we host our code and resources (including the code for this site).
</td>
</tr>
<tr>
<td><a href="https://wiki.dmz.rs/">Wiki</a></td>
<td><a href="https://js.wiki/">Wiki.js</a> instance on which we publish documentation for our projects,
<a href="/events">events</a> resources, and tutorials.
</td>
</tr>
<tr>
<td><a href="https://search.dmz.rs/">Search</a></td>
<td><a href="https://github.com/searxng/searxng/">SearXNG</a> instance used for Web searching.</td>
</tr>
<tr>
<td><a href="https://pastebin.dmz.rs/">Pastebin</a></td>
<td><a href="https://privatebin.info/">PrivateBin</a> instance we use for sharing text files</td>
</tr>
<tr>
<td><a href="ssh://soft.dmz.rs:2222/">Soft Serve</a></td>
<td>
<a href="https://github.com/charmbracelet/soft-serve">Soft Serve</a> instance that we use as a replacement for the Gitea service.
Soft Serve works entirely from the terminal.
</td>
</tr>
</table>
<p>
These are some of the services we currently maintain on our servers.
To use these services, you can register for each service separately,
or you can create a unique <a href="/pages/account.html">account</a>
on our server and use all services with the same account.
</p>

3
pages/en/webring.html Normal file
View File

@ -0,0 +1,3 @@
<ul>
<li><a href="https://tilde.zone/explore">Tilde Zone</a></li>
</ul>

View File

@ -1,59 +1 @@
<h1>Događaji</h1>
<table>
<tbody>
<tr>
<th>Datum</th>
<th>Vreme</th>
<th>Mesto</th>
<th>Tema</th>
</tr>
<tr>
<td> Ponedeljak, 7. Avgust 2023. </td>
<td> 19:00h </td>
<td> DC Krov </td>
<td> Linux ricing </td>
</tr>
<tr>
<td> Utorak, 8. Avgust 2023. </td>
<td> 19:00h </td>
<td> DC Krov </td>
<td> Lambda račun </td>
</tr>
<tr>
<td> Ponedeljak, 14. Avgust 2023. </td>
<td> 19:00h </td>
<td> DC Krov </td>
<td> Linux distro diskusija </td>
</tr>
<tr>
<td> Utorak, 15. Avgust 2023. </td>
<td> 19:00h </td>
<td> DC Krov </td>
<td> Pirati 777 mora </td>
</tr>
<tr>
<td> Ponedeljak, 21. Avgust 2023. </td>
<td> 19:00h </td>
<td> DC Krov </td>
<td> Python vežbe </td>
</tr>
<tr>
<td> Utorak, 22. Avgust 2023. </td>
<td> 19:00h </td>
<td> DC Krov </td>
<td> Autentifikacija na internetu </td>
</tr>
<tr>
<td> Ponedeljak, 28. Avgust 2023. </td>
<td> 19:00h </td>
<td> DC Krov </td>
<td> Podešvanje Mail servera </td>
</tr>
<tr>
<td> Utorak, 29. Avgust 2023. </td>
<td> 19:00h </td>
<td> DC Krov </td>
<td> Prevođenje wiki-ja </td>
</tr>
</tbody>
</table>
<h1>Događaji</h1>

85
prep.py
View File

@ -3,30 +3,16 @@
from datetime import datetime
from functools import cmp_to_key
days = [
"Ponedeljak",
"Utorak",
"Sreda",
"Četvrtak",
"Petak",
"Subota",
"Nedelja",
]
months = [
"Januar",
"Februar",
"Mart",
"April",
"Maj",
"Jun",
"Jul",
"Avgust",
"Septembar",
"Oktobar",
"Novembar",
"Decembar",
]
DAYS_SR = ["Ponedeljak", "Utorak", "Sreda", "Četvrtak", "Petak", "Subota", "Nedelja"]
DAYS_EN = ["Monday ", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"]
MONTHS_SR = [
"Januar", "Februar", "Mart", "April", "Maj", "Jun",
"Jul", "Avgust", "Septembar", "Oktobar", "Novembar", "Decembar",
]
MONTHS_EN = [
"January", "February", "March", "April", "May", "June",
"July", "August", "September", "October", "November", "December",
]
today = datetime.today().date()
@ -66,36 +52,41 @@ def sort_events(events):
return sorted(events, key = cmp_to_key(compare_events))
def build_html(events, dayNames, monthNames):
newevents = []
for event in events:
date, time, location, title = event.split(", ")
date = parse_date(date)
if is_past_event(date):
continue
date = dayNames[date.weekday()]+", "+str(date.day)+". "+monthNames[date.month-1]+" "+str(date.year)+"."
time = time+"h"
future_event = []
future_event.append("<td> "+date+" </td>")
future_event.append("<td> "+time+" </td>")
if "https://" in location:
place,link = location.split("https://")
future_event.append("<td> <a href=\"https://"+link+"\""+"> "+place.strip()+" </a> </td>")
else:
future_event.append("<td> "+location.strip()+" </td>")
future_event.append("<td> "+title+" </td>")
newevents.append("<tr>\n"+"\n".join(future_event)+"\n</tr>")
return newevents
events = load_events()
events = sort_events(events)
write_events(events)
newevents = []
for event in events:
date, time, location, title = event.split(", ")
date = parse_date(date)
if is_past_event(date):
continue
date = days[date.weekday()]+", "+str(date.day)+". "+months[date.month-1]+" "+str(date.year)+"."
time = time+"h"
future_event = []
future_event.append("<td> "+date+" </td>")
future_event.append("<td> "+time+" </td>")
if "https://" in location:
place,link = location.split("https://")
future_event.append("<td> <a href=\"https://"+link+"\""+"> "+place.strip()+" </a> </td>")
else:
future_event.append("<td> "+location.strip()+" </td>")
future_event.append("<td> "+title+" </td>")
newevents.append("<tr>\n"+"\n".join(future_event)+"\n</tr>")
newevents = build_html(events, DAYS_SR, MONTHS_SR)
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(newevents)
file.writelines(["</table>"])
#with open("pages/en/events.html","wt") as file:
# file.writelines(["<h1>Events</h1>", "<table>", "<tr>\n<th>Date</th>\n<th>Time</th>\n<th>Place</th>\n<th>Theme</th>\n</tr>"])
# file.writelines(events)
# file.writelines(["</table>"])
newevents = build_html(events, DAYS_EN, MONTHS_EN)
with open("pages/en/events.html","wt") as file:
file.writelines(["<h1>Events</h1>\n", "<table>\n", "<tr><th>Date</th><th>Time</th><th>Place</th><th>Topic</th></tr>"])
file.writelines(newevents)
file.writelines(["</table>"])

View File

@ -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;
}
}

View File

@ -9,12 +9,13 @@
<link rel="shortcut icon" href="/img/favicon.ico" type="image/x-icon">
<script src="/scripts/main.js" defer></script>
<title><!--TITLE--> Decentrala</title>
<link rel="alternate" hreflang="sr" href="/PAGE_NAME" />
</head>
<body>
<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>
<a class="account" href="/en/account">Account</a>
<a class="lang" hreflang="sr" href="/PAGE_NAME">SR</a>
</header>
<main>
<!--MAIN-->
@ -22,9 +23,10 @@
<footer>
<button id="sections-button" opened="false"><img src="/img/strelica-closed-light.svg" alt="OpenMenu"></button>
<nav>
<a href="/en/events">Događaji</a>
<a href="/en/services">Servisi</a>
<a href="/en/contact">Kontakt</a>
<a href="/en/events">Events</a>
<a href="/en/services">Services</a>
<a href="/en/contact">Contact</a>
<a href="/en/account">Account</a>
</nav>
<span class="links">
<a href="https://creativecommons.org/licenses/by-nc-sa/4.0/"><img src="/img/cc-light.svg" alt="CreativeCommons"></a>

View File

@ -9,12 +9,13 @@
<link rel="shortcut icon" href="/img/favicon.ico" type="image/x-icon">
<script src="/scripts/main.js" defer></script>
<title><!--TITLE--> Decentrala</title>
<link rel="alternate" hreflang="en" href="/en/PAGE_NAME" />
</head>
<body>
<header>
<a id="logo" href="/"><img src="/img/logo-light.svg" alt="Logo"> Decentrala</a>
<button id="theme-switcher"></button>
<a class="account" href="/account">Nalog</a>
<a class="lang" hreflang="en" href="/en/PAGE_NAME">EN</a>
</header>
<main>
<!--MAIN-->
@ -25,6 +26,7 @@
<a href="/events">Događaji</a>
<a href="/services">Servisi</a>
<a href="/contact">Kontakt</a>
<a class="account" href="/account">Nalog</a>
</nav>
<span class="links">
<a href="https://creativecommons.org/licenses/by-nc-sa/4.0/"><img src="/img/cc-light.svg" alt="CreativeCommons"></a>