{% extends "base.jinja" %}
{% from 'snippets/inventory.jinja'  import inventory with context %}
{% from 'snippets/page-detail.jinja'  import showDetail 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 %}
{% block content %}

{% if page['front'] and page['nested'] %}
    {{ showCoverPage(page, documents, "X") }}
{% endif %}

{{ showDetail(page, false) }}
{{ showCircuit(page) }}


{{ showNestedPages(page, documents) }}

{% if false %}

<header>
    <h2>tempalte: post</h2>
    <h1>{{page['title']}}</h1>
</header>

<article>

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

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

     {% if page['media'] %}
        <img src="https://calendar.klank.school/media/thumb/{{ page['media'][0]['url'] }}" alt="" />
    {% endif %}

    {% if page.pdf %}
    <p class="no-print">
        <i>Download this chapter as a <a href="{{ page.pdf }}">PDF</a></i>
    </p>
    {% endif %} 

    {{ page['body'] | shortcode }}

    {% if page.folder == "devices" %}
        <h2>Parts salvaged from this device</h2>
        {{ inventory("Where", ( page.title.capitalize() | slugify )) }}
    {%  endif %}

    {% if page.folder == "components" %}

        {{inventory("type", (page.type.capitalize()  | slugify)) }}
    {%  endif %}
</article>
{% endif %}
{% endblock %} {% block aside %} {% endblock %}
