{% extends "base.jinja" %}

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


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

{% for  result in documents['chapters'] %}
        <section template-type="chapter">

            {% if result['front'] %}
                   <section class="meta">
                    <span data-chapter-title>{{result['title']}}</span>
                </section>
                <header class="page--cover">

                <h3>Chapter {{loop.index0}}</h3>
                <h1>{{result['title']}}</h1>

                {% if result['nested'] %}

                    <ul class="list--frontpage">
                        {% for nest in documents[result['nested']] %}
                            <li><h3>{{nest['title']}} +<ins> (pagenr/link)</ins></h3></li>
                        {% endfor %}
                    </ul>
                {% endif %}
            </header>
        {% endif %}
        <article>
            {% if not result['front'] %}
               <section class="meta">
                    <span data-chapter-title>{{result['title']}}</span>
                </section>
        {% endif %}
        <header>
            <h1>{{result['title']}}</h1>
        </header>
        {{result['body'] | shortcode}}
    </article>
</section>

{% if result['nested']%}
    {% for nest in documents[result['nested']] %}
        
         <article>
            <section class="meta">
                    <span data-chapter-title>{{nest['title']}}</span>
                </section>
            <header>
                <h1>{{nest['title']}}</h1>
                <h5>Also known as {{nest['alsoKnownAs']}}</h5>
            </header>

            {% if nest['image'] %}<img src="{{ nest['image'] }}" alt="" />{% endif %}

                <dl>
                    <dt>Material</dt>
                    <dd>{{nest['material']}}</dd>
                    <dt>Usage</dt>
                    <dd>{{nest['usage']}}</dd>
                    <dt>Typically found in</dt>
                    <dd>{{nest['whereToFind']}}</dd>
                    {% if nest['schematicSymbol'] %}
                        <dt>Schematic symbol</dt>
                        <dd><img src="{{nest['schematicSymbol']}}" /></dd>
                    {% endif %}
                </dl>
            

                {{nest['body']}}

         </article>
        {% endfor %}
    {% endif %}

{% endfor %}





{% endblock %}

{% block aside %} {% endblock %}