From 8eb760816a06e4f0382816f82586204d1e7734fd Mon Sep 17 00:00:00 2001 From: MinchinWeb Date: Wed, 11 Jan 2017 13:27:55 -0700 Subject: [PATCH] FIx archives page template code to work with Jinja 2.9 Closes #10 --- docs/changelog.rst | 1 + seafoam/templates/archives.html | 63 +++++++++++++++++---------------- 2 files changed, 34 insertions(+), 30 deletions(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index 3b5ab7b..72c9333 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -2,6 +2,7 @@ Changelog ========= - :release:`2.0.3 <2017-01-10>` +- :bug:`10` fix archive page template code to work with Jinja2 v2.9.0 - :bug:`-` fix link color in body area of panel-primary (fixes regression from version 2.0.2) - :release:`2.0.2 <2017-01-10>` diff --git a/seafoam/templates/archives.html b/seafoam/templates/archives.html index b2aefd0..bbd87b1 100644 --- a/seafoam/templates/archives.html +++ b/seafoam/templates/archives.html @@ -19,15 +19,24 @@ {% block content %}

Archives for {{ SITENAME }}

+ + {# + {% for article in dates %} + {{ dates[loop.index0].date }} - + {{ article.date }} + {{loop.index0 == 0 }} + {{(article.date.year != dates[loop.index0 - 1].date.year)}} / + {% endfor %} + #} + +
{# Top Row with links to Archives by Year #}
{# Main Archive Listing #} - {%- set last_year = None -%} - {%- set last_month = None -%} - {%- set last_day = None -%} - {% for article in dates %}
- {% if article.date.year != last_year %} - {% if last_year != None -%} + {% if (loop.index0 == 0) or (article.date.year != dates[loop.index0 - 1].date.year) %} + {% if loop.index0 != 0 -%}
 
 
{%- endif %} @@ -55,37 +60,35 @@

Archives for {{ SITENAME }}

 
- {%- set last_year = article.date.year -%} - {%- set last_month = None -%} - {%- set last_day = None -%} {% endif %} - {% if article.date.month != last_month %} - {% if last_month != None -%} -
 
- {%- endif %} -
- - {{- article.date|strftime('%B') -}} -
-
-   -
- {%- set last_month = article.date.month -%} - {%- set last_day = None -%} + {% if (loop.index0 == 0) or + (article.date.year != dates[loop.index0 - 1].date.year) or + ((article.date.year == dates[loop.index0 - 1].date.year) and (article.date.month != dates[loop.index0 - 1].date.month)) %} + {% if ((article.date.year == dates[loop.index0 - 1].date.year) and (article.date.month != dates[loop.index0 - 1].date.month)) -%} +
 
+ {%- endif %} +
+ + {{- article.date|strftime('%B') -}} +
+
+   +
{% endif %}
- {%- if last_day != article.date.day %} - + {%- if ((article.date.day == dates[loop.index0 - 1].date.day) and + (article.date.month == dates[loop.index0 - 1].date.month) and + (article.date.year == dates[loop.index0 - 1].date.year)) %} + — {% else -%} -   + {%- endif -%}
{{ article.title }} {% if article.subtitle %}
{{ article.subtitle }}{% endif %}
- {%- set last_day = article.date.day %}
{% endfor %}