Implement the English version #16
@ -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>
|
58
prep.py
58
prep.py
@ -3,29 +3,15 @@
|
||||
from datetime import datetime
|
||||
from functools import cmp_to_key
|
||||
|
||||
days = [
|
||||
"Ponedeljak",
|
||||
"Utorak",
|
||||
"Sreda",
|
||||
"Četvrtak",
|
||||
"Petak",
|
||||
"Subota",
|
||||
"Nedelja",
|
||||
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 = [
|
||||
"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,18 +52,14 @@ def sort_events(events):
|
||||
return sorted(events, key = cmp_to_key(compare_events))
|
||||
|
||||
|
||||
events = load_events()
|
||||
events = sort_events(events)
|
||||
write_events(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 = days[date.weekday()]+", "+str(date.day)+". "+months[date.month-1]+" "+str(date.year)+"."
|
||||
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>")
|
||||
@ -89,13 +71,25 @@ for event in events:
|
||||
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)
|
||||
|
||||
print(events)
|
||||
|
||||
newevents = build_html(events, DAYS_SR, MONTHS_SR)
|
||||
print(newevents)
|
||||
|
||||
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>"])
|
||||
|
Loading…
Reference in New Issue
Block a user