{% extends "base.html" %}

{% block title %} {{ config.title }} | {{ page.title }} {% endblock title %}

{% block nav %}
  <ul id="breadcrumbs">
    {% for parent in page.ancestors %}
      {% set s = get_section(path=parent, include_pages=false) %}
      <li><a href="{{s.permalink}}">{{s.title}}</a>&nbsp;/&nbsp;</li> 
    {% endfor %}
  </ul>
  <h1>{{ page.title }}</h1><em>{{ page.description | safe }}</em> 
{% endblock nav %}

{% block content %}
<h1>{{ page.title }}</h1>
{{ page.content | safe }}
{% endblock content %}

{% block toc %}
  {% set_global header_count = 0 %}
  {% for h2 in page.toc %}
    {% set_global header_count = header_count + 1 %}
    {% for h3 in h2.children %}
      {% set_global header_count = header_count + 1 %}
      {% for h4 in h3.children %}
        {% set_global header_count = header_count + 1 %}
      {% endfor %}
    {% endfor %}
  {% endfor %}

      <ul id="toc">
        {% for h2 in page.toc %}
          <li>
            {{ macro::toclink(item=h2) }}
            {% if h2.children %}
            <ul>
              {% for h3 in h2.children %}
              <li>
                {{ macro::toclink(item=h3) }}
                {% if h3.children %}
                <ul>
                  {% for h4 in h3.children %}
                  <li>
                    {{ macro::toclink(item=h4) }}
                  </li>
                  {% endfor %}
                </ul>
                {% endif %}
              </li>
              {% endfor %}
            </ul>
            {% endif %}
          </li>
        {% endfor %}
      </ul>
{% endblock %}
