Note location or time change on events page
This commit is contained in:
23
prep.py
23
prep.py
@@ -30,16 +30,15 @@ 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 = ""
|
||||
link = event[5]
|
||||
changed = event[6]
|
||||
current_event = {"date":event_date_parsed,
|
||||
"time":event_time,
|
||||
"location": event_location,
|
||||
"title":event_title.strip(),
|
||||
"types": types,
|
||||
"link": link}
|
||||
"link": link,
|
||||
"changed": changed.strip()}
|
||||
events.append(current_event)
|
||||
return events
|
||||
|
||||
@@ -51,17 +50,25 @@ def build_html(events: list[dict], dayNames: list[str], typesNames: dict) -> str
|
||||
date = event["date"]
|
||||
date = dayNames[date.weekday()]+", "+str(date.day)+". "+str(date.month)+". "+str(date.year)+", "
|
||||
time = event["time"]+"h"
|
||||
changed = event["changed"]
|
||||
event_html = []
|
||||
event_html.append(f"<div class='date'>{date} {time}</div>")
|
||||
|
||||
timeChanged = changed == "time" or changed == "date"
|
||||
locationChanged = changed == "location"
|
||||
|
||||
event_html.append(f"<div class='date {"changed" if timeChanged else ""}'>{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>")
|
||||
if "https://" in location:
|
||||
place,link = location.split("https://")
|
||||
event_html.append(f"<div class='place'><a href=\"https://{link}\">@{place.strip()}</a></div>")
|
||||
event_html.append(f"<div class='place {"changed" if locationChanged else ""}'><a href=\"https://{link}\">@{place.strip()}</a></div>")
|
||||
else:
|
||||
event_html.append(f"<div class='place'>@{location.strip()}</div>")
|
||||
event_html.append(f"<div class='place {"changed" if locationChanged else ""}'>@{location.strip()}</div>")
|
||||
|
||||
if changed != "":
|
||||
event_html.append("<div class ='changedMark'></div>")
|
||||
|
||||
if len(event["types"]) != 0:
|
||||
types_list = "<div class='types'>"
|
||||
|
Reference in New Issue
Block a user