{#  -*- coding: utf-8 -*- #}
{% extends 'base.tmpl' %}
{% import 'feeds_translations_helper.tmpl' as feeds_translations with context %}

{% block extra_head %}
    {{ feeds_translations.head(kind=kind, feeds=False) }}
{% endblock %}

{% block content %}
<article class="tagindex">
    <header>
        <h1>{{ title|e }}</h1>
        <div class="metadata">
            {{ feeds_translations.translation_link(kind) }}
        </div>
    </header>
    {% if cat_items %}
        {% if items %}
            <h2>{{ messages("Categories") }}</h2>
        {% endif %}
        {% for text, full_name, path, link, indent_levels, indent_change_before, indent_change_after in cat_hierarchy %}
            {% for i in range(indent_change_before) %}
                <ul class="postlist">
            {% endfor %}
            <li><a class="reference" href="{{ link }}">{{ text }}</a>
            {% if indent_change_after <= 0 %}
                </li>
            {% endif %}
            {% for i in range(-indent_change_after) %}
                </ul>
                {% if i + 1 < indent_levels|length %}
                    </li>
                {% endif %}
            {% endfor %}
        {% endfor %}
        {% if items %}
            <h2>{{ messages("Tags") }}</h2>
        {% endif %}
    {% endif %}
    {% if items %}
        <ul class="postlist">
        {% for text, link in items %}
            {% if text not in hidden_tags %}
                <li><a class="reference listtitle" href="{{ link }}">{{ text|e }}</a></li>
            {% endif %}
        {% endfor %}
        </ul>
    {% endif %}
</article>
{% endblock %}
