forked from Decentrala/website
add an ability to add links to events
This commit is contained in:
12
prep.py
12
prep.py
@@ -29,11 +29,16 @@ def load_events(csv_path:str) -> list[dict]:
|
||||
event_location = event[2]
|
||||
event_title = event[3]
|
||||
types = event[4].split()
|
||||
try:
|
||||
link = event[5]
|
||||
except IndexError:
|
||||
link = ""
|
||||
current_event = {"date":event_date_parsed,
|
||||
"time":event_time,
|
||||
"location": event_location,
|
||||
"title":event_title.strip(),
|
||||
"types": types }
|
||||
"types": types,
|
||||
"link": link}
|
||||
events.append(current_event)
|
||||
return events
|
||||
|
||||
@@ -47,7 +52,10 @@ def build_html(events: list[dict], dayNames: list[str], typesNames: dict) -> str
|
||||
time = event["time"]+"h"
|
||||
event_html = []
|
||||
event_html.append(f"<div class='date'>{date} {time}</div>")
|
||||
event_html.append(f"<div class='title'>{title}</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>")
|
||||
if "https://" in location:
|
||||
place,link = location.split("https://")
|
||||
event_html.append(f"<div class='place'><a href=\"https://{link}\">@{place.strip()}</a></div>")
|
||||
|
Reference in New Issue
Block a user