summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build.py21
1 files changed, 17 insertions, 4 deletions
diff --git a/build.py b/build.py
index 8427010..24fe7b2 100644
--- a/build.py
+++ b/build.py
@@ -17,7 +17,7 @@ latest_scheduled = datetime.date.today()
class Event:
- def __init__(self, line):
+ def __init__(self, line, prefix=""):
global latest_scheduled
# timestamp (start time)
year, month, day = (int(s) for s in line.split("<")[1][0:10].split("-"))
@@ -35,7 +35,7 @@ class Event:
# time of day
tod = line[line.find("<") + 1 : line.find(">")][15:]
# description
- self.description = " ".join(filter(None, [tod, line.split(">")[-1].strip()]))
+ self.description = " ".join(filter(None, [tod, prefix, line.split(">")[-1].strip()]))
org_fp = "/home/nginx/org/agenda.org"
@@ -72,7 +72,20 @@ with open(org_fp, "r") as org:
continue
if ":info:" in line:
continue
- events.append(Event(line))
+ events.append(Event(line, prefix="⚗️"))
+
+
+# sort -------------------------------------------------------------------------------------------
+
+
+def get_timestamp(event):
+ if event.description[0].isdigit():
+ return f"__{event.description}"
+ else:
+ return event.description
+
+
+sorted_events = sorted(events, key=get_timestamp)
# create html -------------------------------------------------------------------------------------
@@ -117,7 +130,7 @@ with open(__here__ / "public" / "index.html", "w") as html:
html.write(
f"<h3 id={id}><a href=#{id}>{day.isoformat()} {day.strftime('%A')}</a></h3>"
)
- for event in events:
+ for event in sorted_events:
try:
total = event.end - event.timestamp
assert total.days > 0