Compare commits
2 Commits
6225b664a7
...
ae351c9685
Author | SHA1 | Date | |
---|---|---|---|
ae351c9685 | |||
4c64ecae24 |
@ -38,6 +38,10 @@ section .description {
|
|||||||
list-style-position: inside;
|
list-style-position: inside;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
section.years-index {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
footer {
|
footer {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
@ -53,10 +53,40 @@ def main(ics_url, out_path):
|
|||||||
|
|
||||||
(out_path / "chaosevents.ics").write_text(r.text)
|
(out_path / "chaosevents.ics").write_text(r.text)
|
||||||
|
|
||||||
|
events_by_year = {}
|
||||||
|
|
||||||
|
for event in t:
|
||||||
|
if event.begin.year not in events_by_year:
|
||||||
|
events_by_year[event.begin.year] = []
|
||||||
|
events_by_year[event.begin.year].append(event)
|
||||||
|
|
||||||
|
years_index = sorted(events_by_year.keys())
|
||||||
|
|
||||||
|
# Index page
|
||||||
|
|
||||||
|
sections = {}
|
||||||
|
if any(t.now()):
|
||||||
|
sections["Current"] = t.now()
|
||||||
|
sections["Upcoming"] = t.start_after(arrow.utcnow())
|
||||||
|
|
||||||
(out_path / "index.html").write_text(
|
(out_path / "index.html").write_text(
|
||||||
env.get_template("index.html").render(
|
env.get_template("index.html").render(
|
||||||
currentevents=t.now() if any(t.now()) else None,
|
sections=sections,
|
||||||
upcomingevents=t.start_after(arrow.utcnow())
|
years_index=years_index,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
# Year pages
|
||||||
|
|
||||||
|
for year, year_events in events_by_year.items():
|
||||||
|
year_directory = out_path / "year" / str(year)
|
||||||
|
year_directory.mkdir(exist_ok=True, parents=True)
|
||||||
|
|
||||||
|
(year_directory / "index.html").write_text(
|
||||||
|
env.get_template("index.html").render(
|
||||||
|
title=f"Year {year}",
|
||||||
|
sections={f"Year {year}": year_events},
|
||||||
|
years_index=years_index,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<title>Upcoming Chaos Events</title>
|
<title>{% if title %}{{ title }} | {% endif %}Upcoming Chaos Events</title>
|
||||||
<link rel="stylesheet" href="/style.css">
|
<link rel="stylesheet" href="/style.css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
@ -13,11 +13,11 @@
|
|||||||
<a href="/chaosevents.ics">Add to calendar</a> | <a href="mailto:chaosevents@clerie.de"> Event missing?</a>
|
<a href="/chaosevents.ics">Add to calendar</a> | <a href="mailto:chaosevents@clerie.de"> Event missing?</a>
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
{% if currentevents %}
|
{% for section_title, section_events in sections.items() %}
|
||||||
<section>
|
<section>
|
||||||
<h2>Current</h2>
|
<h2>{{ section_title }}</h2>
|
||||||
</section>
|
</section>
|
||||||
{% for event in currentevents %}
|
{% for event in section_events %}
|
||||||
<section>
|
<section>
|
||||||
<h3>{{ event.name }} <span class="date">{{ event.begin.format("YYYY-MM-DD") }} - {{ event.end.shift(seconds=-1).format("YYYY-MM-DD") }}</span></h3>
|
<h3>{{ event.name }} <span class="date">{{ event.begin.format("YYYY-MM-DD") }} - {{ event.end.shift(seconds=-1).format("YYYY-MM-DD") }}</span></h3>
|
||||||
<div class="description">
|
<div class="description">
|
||||||
@ -25,18 +25,13 @@
|
|||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
|
||||||
<section>
|
|
||||||
<h2>Upcoming</h2>
|
|
||||||
</section>
|
|
||||||
{% for event in upcomingevents %}
|
|
||||||
<section>
|
|
||||||
<h3>{{ event.name }} <span class="date">{{ event.begin.format("YYYY-MM-DD") }} - {{ event.end.shift(seconds=-1).format("YYYY-MM-DD") }}</span></h3>
|
|
||||||
<div class="description">
|
|
||||||
{{ event.description_rendered|safe }}
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
<section class="years-index">
|
||||||
|
<a href="/">Upcoming</a>
|
||||||
|
{% for year in years_index %}
|
||||||
|
| <a href="/year/{{ year }}/">{{ year }}</a>
|
||||||
|
{% endfor %}
|
||||||
|
</section>
|
||||||
<footer>
|
<footer>
|
||||||
<a href="https://legal.clerie.de/impressum">Imprint</a> | <a href="https://legal.clerie.de/datenschutz">Privacy</a> | <a href="https://git.clerie.de/clerie/chaosevents">Source Code</a>
|
<a href="https://legal.clerie.de/impressum">Imprint</a> | <a href="https://legal.clerie.de/datenschutz">Privacy</a> | <a href="https://git.clerie.de/clerie/chaosevents">Source Code</a>
|
||||||
</footer>
|
</footer>
|
||||||
|
Loading…
Reference in New Issue
Block a user