{% from 'snippets/page-detail.jinja' import showDetail with context %}
{% from 'snippets/page-front.jinja' import pageFront with context %}
{% from 'snippets/page-circuit.jinja'  import showCircuit with context %}
{% from 'snippets/pages-nest.jinja'  import showNestedPages with context %}
{% from 'snippets/page-cover.jinja'  import showCoverPage with context %}

{% extends "base.jinja" %}

{% block content %}
    <section template-type="front" jinja="thesis.jinja">
        <section class="meta">
            {% if documents["meta"] %}
              <span data-generated-date>{{documents["meta"]["now"]}}</span>
            {% endif %}
            <span data-publication-title>{{page['title']}}</span>
        </section>
        <header>
            <h2>A field guide to</h2>
            <h1>Salvaging Sound Devices</h1>
            {% if documents["meta"] %}
              <p>Version {{documents['meta']['version']}} | {{documents['meta']['count']}} words</p>
              <p>{{documents["meta"]["now"]}}</p>
            {% endif %}

        </header>
    </section>


    <section template-type="chapter">
        <article>
            {{page['body'] | shortcode}}
        </article>
    </section>


    {% for  chapter in documents['chapters'] %}
        {% if chapter['title']|lower != 'index' %}
            <section template-type="chapter">

                {% if chapter['front'] %}
                    {{ showCoverPage(chapter, documents, loop.inex0) }}
                {% endif %}
            <article>
                {% if not chapter['front'] %}
                 <section class="meta">
                    <span data-chapter-title>{{chapter['title']}}</span>
                </section>
            {% endif %}
            <header>
                <h1>{{chapter['title']}}</h1>
            </header>
            {{chapter['body'] | shortcode}}
        </article>
    </section>

    {{ showNestedPages(chapter, documents) }}

    {% endif %}
{% endfor %}




<span template-type="bib"></span>
{% endblock %}

{% block aside %} {% endblock %}