Make sure that lists are closed

This commit is contained in:
Oliver Davies 2015-07-16 01:00:43 +01:00
parent a0f66d6809
commit f423bbfece

View file

@ -55,6 +55,7 @@ talks:
{% set found = false %}
{% set year = '0' %}
{% set new_year = false %}
{% for talk in talks|reverse if talk.date >= now %}
{% if loop.first %}
@ -62,17 +63,28 @@ talks:
{% endif %}
{% set this_year %}{{ talk.date|date('Y') }}{% endset %}
{% if this_year != year %}
{% if new_year %}
{# Close the list for the previous year. #}
</ul>
{% endif %}
{% set found = true %}
{% set year = this_year %}
<h3>{{ this_year }}</h3>
<ul>
{% else %}
{% set new_year = true %}
{% endif %}
<li>{{ talk.title }}</li>
{% endfor %}
</ul>
{% if found %}
</ul>
{% endif %}
{% set found = false %}
{% set year = '0' %}
@ -102,4 +114,8 @@ talks:
<li>{{ talk.title }}</li>
{% endfor %}
{% if found %}
</ul>
{% endif %}
{% endblock %}