add an ability to add links to events #24

Merged
hugo merged 1 commits from mkevac/website:master into master 2024-07-28 19:53:02 +00:00
2 changed files with 12 additions and 4 deletions

View File

@ -1,4 +1,4 @@
datum, vreme, lokacija, tema, tip, datum, vreme, lokacija, tema, tip, link
20-12-2022, 19:00, DC Krov https://www.openstreetmap.org/node/10594728522, Uvod u računarske mreže, , 20-12-2022, 19:00, DC Krov https://www.openstreetmap.org/node/10594728522, Uvod u računarske mreže, ,
03-01-2023, 19:00, DC Krov https://www.openstreetmap.org/node/10594728522, Hackathon žurka, hack, 03-01-2023, 19:00, DC Krov https://www.openstreetmap.org/node/10594728522, Hackathon žurka, hack,
16-01-2023, 19:00, DC Krov https://www.openstreetmap.org/node/10594728522, Privatnost na internetu, workshop, 16-01-2023, 19:00, DC Krov https://www.openstreetmap.org/node/10594728522, Privatnost na internetu, workshop,
@ -162,7 +162,7 @@ datum, vreme, lokacija, tema, tip,
09-07-2024, 19:00, DC Krov https://www.openstreetmap.org/node/10594728522, Hakaton, hack, 09-07-2024, 19:00, DC Krov https://www.openstreetmap.org/node/10594728522, Hakaton, hack,
12-07-2024, 15:00, KC Gnezdo https://osm.org/go/xftd8rbl2, Uticaj tehnologije na kulturu, lecture, 12-07-2024, 15:00, KC Gnezdo https://osm.org/go/xftd8rbl2, Uticaj tehnologije na kulturu, lecture,
14-07-2024, 19:00, DC Krov https://www.openstreetmap.org/node/10594728522, Napadi na vestacku inteligenciju, lecture discussion 14-07-2024, 19:00, DC Krov https://www.openstreetmap.org/node/10594728522, Napadi na vestacku inteligenciju, lecture discussion
29-07-2024, 19:00, DC Krov https://www.openstreetmap.org/node/10594728522, OnionShare, lecture 29-07-2024, 19:00, DC Krov https://www.openstreetmap.org/node/10594728522, OnionShare, lecture, https://forum.dmz.rs/t/plan-za-jul-2024/612/17?u=mkevac
30-07-2024, 19:00, DC Krov https://www.openstreetmap.org/node/10594728522, CryptoPals #1, workshop 30-07-2024, 19:00, DC Krov https://www.openstreetmap.org/node/10594728522, CryptoPals #1, workshop
15-08-2024, 19:00, DC Krov https://www.openstreetmap.org/node/10594728522, GETÖSEFÖHN, music 15-08-2024, 19:00, DC Krov https://www.openstreetmap.org/node/10594728522, GETÖSEFÖHN, music
15-09-2024, 12:00, KC Magacin https://www.openstreetmap.org/node/1226456745#map=19/44.81314/20.45378, Dekonferencija, conference, 15-09-2024, 12:00, KC Magacin https://www.openstreetmap.org/node/1226456745#map=19/44.81314/20.45378, Dekonferencija, conference,

Can't render this file because it has a wrong number of fields in line 30.

10
prep.py
View File

@ -29,11 +29,16 @@ def load_events(csv_path:str) -> list[dict]:
event_location = event[2] event_location = event[2]
event_title = event[3] event_title = event[3]
types = event[4].split() types = event[4].split()
try:
link = event[5]
except IndexError:
link = ""
current_event = {"date":event_date_parsed, current_event = {"date":event_date_parsed,
"time":event_time, "time":event_time,
"location": event_location, "location": event_location,
"title":event_title.strip(), "title":event_title.strip(),
"types": types } "types": types,
"link": link}
events.append(current_event) events.append(current_event)
return events return events
@ -47,6 +52,9 @@ def build_html(events: list[dict], dayNames: list[str], typesNames: dict) -> str
time = event["time"]+"h" time = event["time"]+"h"
event_html = [] event_html = []
event_html.append(f"<div class='date'>{date} {time}</div>") event_html.append(f"<div class='date'>{date} {time}</div>")
if event["link"] != "":
event_html.append(f"<div class='title'><a href=\"{event['link']}\">{title}</a></div>")
else:
event_html.append(f"<div class='title'>{title}</div>") event_html.append(f"<div class='title'>{title}</div>")
if "https://" in location: if "https://" in location:
place,link = location.split("https://") place,link = location.split("https://")