{% extends 'base.html' %}

{% block title %}{% if 1 in compound.breadcrumb or compound.breadcrumb[-1][0] != PROJECT_NAME %}{% set j = joiner(' &raquo; ') %}{% for name, _ in compound.breadcrumb %}{{ j() }}{{ name }}{% endfor %} | {{ super() }}{% else %}{{ super() }}{% endif %}{% endblock %}

{% block header_links %}
{% if compound.footer_navigation and compound.footer_navigation[0] %}
  <link rel="prev" href="{{ compound.footer_navigation[0][0] }}" />
{% endif %}
{% if compound.footer_navigation and compound.footer_navigation[2] %}
  <link rel="next" href="{{ compound.footer_navigation[2][0] }}" />
{% endif %}
{% endblock %}

{% block main %}
        <h1>
          {% for name, target in compound.breadcrumb[:-1] %}
          <span class="m-breadcrumb"><a href="{{ target }}">{{ name }}</a> &raquo;</span>
          {% endfor %}
          {{ compound.breadcrumb[-1][0] }}
        </h1>
        {% if compound.brief %}
        <p>{{ compound.brief }}</p>
        {% endif %}
        {% if compound.sections %}
        <div class="m-block m-default">
          <h3>Contents</h3>
          <ul>
            {% for id, name, children in compound.sections recursive %}
            {% if children %}
            <li>
              <a href="#{{ id }}">{{ name }}</a>
              <ul>
{{ loop(children)|indent(4, true) }}
              </ul>
            </li>
            {% else %}
            <li><a href="#{{ id }}">{{ name }}</a></li>
            {% endif %}
            {% endfor %}
          </ul>
        </div>
        {% endif %}
        {% if compound.description %}
{{ compound.description }}
        {% endif %}
        {% if compound.footer_navigation %}
        <div class="m-note m-dim m-thin m-text-center">{% if compound.footer_navigation[0] %}<a href="{{ compound.footer_navigation[0][0] }}" class="m-doc">&laquo; {{ compound.footer_navigation[0][1] }}</a> | {% endif %}<a href="{{ compound.footer_navigation[1][0] }}" class="m-doc">{{ compound.footer_navigation[1][1] }}</a>{% if compound.footer_navigation[2] %} | <a href="{{ compound.footer_navigation[2][0] }}" class="m-doc">{{ compound.footer_navigation[2][1] }} &raquo;</a>{% endif %}</div>
        {% endif %}
{% endblock %}
