diff --git a/pages/sr/events.html b/pages/sr/events.html
index 21df750..c6c2c27 100644
--- a/pages/sr/events.html
+++ b/pages/sr/events.html
@@ -1,59 +1 @@
-
Događaji
-
-
-
- Datum |
- Vreme |
- Mesto |
- Tema |
-
-
- Ponedeljak, 7. Avgust 2023. |
- 19:00h |
- DC Krov |
- Linux ricing |
-
-
- Utorak, 8. Avgust 2023. |
- 19:00h |
- DC Krov |
- Lambda račun |
-
-
- Ponedeljak, 14. Avgust 2023. |
- 19:00h |
- DC Krov |
- Linux distro diskusija |
-
-
- Utorak, 15. Avgust 2023. |
- 19:00h |
- DC Krov |
- Pirati 777 mora |
-
-
- Ponedeljak, 21. Avgust 2023. |
- 19:00h |
- DC Krov |
- Python vežbe |
-
-
- Utorak, 22. Avgust 2023. |
- 19:00h |
- DC Krov |
- Autentifikacija na internetu |
-
-
- Ponedeljak, 28. Avgust 2023. |
- 19:00h |
- DC Krov |
- Podešvanje Mail servera |
-
-
- Utorak, 29. Avgust 2023. |
- 19:00h |
- DC Krov |
- Prevođenje wiki-ja |
-
-
-
\ No newline at end of file
+Događaji
\ No newline at end of file
diff --git a/prep.py b/prep.py
index 8cfd463..4a41c98 100644
--- a/prep.py
+++ b/prep.py
@@ -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,44 @@ 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(" "+date+" | ")
+ future_event.append(" "+time+" | ")
+ if "https://" in location:
+ place,link = location.split("https://")
+ future_event.append(" "+place.strip()+" | ")
+ else:
+ future_event.append(" "+location.strip()+" | ")
+ future_event.append(" "+title+" | ")
+ newevents.append("\n"+"\n".join(future_event)+"\n
")
+ return newevents
+
events = load_events()
events = sort_events(events)
write_events(events)
-newevents = []
+print(events)
-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(" "+date+" | ")
- future_event.append(" "+time+" | ")
- if "https://" in location:
- place,link = location.split("https://")
- future_event.append(" "+place.strip()+" | ")
- else:
- future_event.append(" "+location.strip()+" | ")
- future_event.append(" "+title+" | ")
- newevents.append("\n"+"\n".join(future_event)+"\n
")
+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", "Datum | Vreme | Mesto | Tema |
\n"])
file.writelines(newevents)
file.writelines(["
"])
-#with open("pages/en/events.html","wt") as file:
-# file.writelines(["Events
", "", "\nDate | \nTime | \nPlace | \nTheme | \n
"])
-# file.writelines(events)
-# file.writelines(["
"])
+newevents = build_html(events, DAYS_EN, MONTHS_EN)
+
+with open("pages/en/events.html","wt") as file:
+ file.writelines(["Events
\n", "\n", "Date | Time | Place | Topic |
"])
+ file.writelines(newevents)
+ file.writelines(["
"])