Implement the English version #16
@ -1,59 +1 @@
|
|||||||
<h1>Događaji</h1>
|
<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 datetime import datetime
|
||||||
from functools import cmp_to_key
|
from functools import cmp_to_key
|
||||||
|
|
||||||
days = [
|
DAYS_SR = ["Ponedeljak", "Utorak", "Sreda", "Četvrtak", "Petak", "Subota", "Nedelja"]
|
||||||
"Ponedeljak",
|
DAYS_EN = ["Monday ", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"]
|
||||||
"Utorak",
|
MONTHS_SR = [
|
||||||
"Sreda",
|
"Januar", "Februar", "Mart", "April", "Maj", "Jun",
|
||||||
"Četvrtak",
|
"Jul", "Avgust", "Septembar", "Oktobar", "Novembar", "Decembar",
|
||||||
"Petak",
|
|
||||||
"Subota",
|
|
||||||
"Nedelja",
|
|
||||||
]
|
]
|
||||||
|
MONTHS_EN = [
|
||||||
months = [
|
"January", "February", "March", "April", "May", "June",
|
||||||
"Januar",
|
"July", "August", "September", "October", "November", "December",
|
||||||
"Februar",
|
|
||||||
"Mart",
|
|
||||||
"April",
|
|
||||||
"Maj",
|
|
||||||
"Jun",
|
|
||||||
"Jul",
|
|
||||||
"Avgust",
|
|
||||||
"Septembar",
|
|
||||||
"Oktobar",
|
|
||||||
"Novembar",
|
|
||||||
"Decembar",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
today = datetime.today().date()
|
today = datetime.today().date()
|
||||||
@ -66,18 +52,14 @@ def sort_events(events):
|
|||||||
return sorted(events, key = cmp_to_key(compare_events))
|
return sorted(events, key = cmp_to_key(compare_events))
|
||||||
|
|
||||||
|
|
||||||
events = load_events()
|
def build_html(events, dayNames, monthNames):
|
||||||
events = sort_events(events)
|
|
||||||
write_events(events)
|
|
||||||
|
|
||||||
newevents = []
|
newevents = []
|
||||||
|
|
||||||
for event in events:
|
for event in events:
|
||||||
date, time, location, title = event.split(", ")
|
date, time, location, title = event.split(", ")
|
||||||
date = parse_date(date)
|
date = parse_date(date)
|
||||||
if is_past_event(date):
|
if is_past_event(date):
|
||||||
continue
|
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"
|
time = time+"h"
|
||||||
future_event = []
|
future_event = []
|
||||||
future_event.append("<td> "+date+" </td>")
|
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> "+location.strip()+" </td>")
|
||||||
future_event.append("<td> "+title+" </td>")
|
future_event.append("<td> "+title+" </td>")
|
||||||
newevents.append("<tr>\n"+"\n".join(future_event)+"\n</tr>")
|
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:
|
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"])
|
||||||
file.writelines(newevents)
|
file.writelines(newevents)
|
||||||
file.writelines(["</table>"])
|
file.writelines(["</table>"])
|
||||||
|
|
||||||
#with open("pages/en/events.html","wt") as file:
|
newevents = build_html(events, DAYS_EN, MONTHS_EN)
|
||||||
# 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)
|
with open("pages/en/events.html","wt") as file:
|
||||||
# file.writelines(["</table>"])
|
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