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