Generate sections from content dict
This commit is contained in:
parent
6225b664a7
commit
4c64ecae24
@ -53,10 +53,17 @@ def main(ics_url, out_path):
|
||||
|
||||
(out_path / "chaosevents.ics").write_text(r.text)
|
||||
|
||||
sections = {}
|
||||
|
||||
if any(t.now()):
|
||||
sections["Current"] = t.now()
|
||||
|
||||
sections["Upcoming"] = t.start_after(arrow.utcnow())
|
||||
|
||||
|
||||
(out_path / "index.html").write_text(
|
||||
env.get_template("index.html").render(
|
||||
currentevents=t.now() if any(t.now()) else None,
|
||||
upcomingevents=t.start_after(arrow.utcnow())
|
||||
sections=sections,
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -13,11 +13,11 @@
|
||||
<a href="/chaosevents.ics">Add to calendar</a> | <a href="mailto:chaosevents@clerie.de"> Event missing?</a>
|
||||
</div>
|
||||
</header>
|
||||
{% if currentevents %}
|
||||
{% for section_title, section_events in sections.items() %}
|
||||
<section>
|
||||
<h2>Current</h2>
|
||||
<h2>{{ section_title }}</h2>
|
||||
</section>
|
||||
{% for event in currentevents %}
|
||||
{% for event in section_events %}
|
||||
<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">
|
||||
@ -25,17 +25,6 @@
|
||||
</div>
|
||||
</section>
|
||||
{% 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 %}
|
||||
<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>
|
||||
|
Loading…
Reference in New Issue
Block a user