{% extends "main::container.html" %}

{% macro header_passage() %}
<header>
    <h1>{{version.parents[0].metadata["title"][lang]}}</h1>
    <h2>{{version.parents[1].metadata["groupname"][lang]}}</h2>
    <p><small><i>{{version.metadata["description"][lang]}}</i></small></p>
</header>
{% endmacro %}

{% macro nav() %}
    {% if prev %}
    <a class="btn btn-xs btn-primary" href="{{url_for('.r_passage', collection=url['collection'], textgroup=url['textgroup'], work=url['work'], version=url['version'], passage_identifier=prev) }}">
        <span class="glyphicon glyphicon-chevron-left"></span>
    </a>
    {% endif %}
    {% if next %}
    <a class="btn btn-xs btn-primary" href="{{url_for('.r_passage', collection=url['collection'], textgroup=url['textgroup'], work=url['work'], version=url['version'], passage_identifier=next) }}">
        <span class="glyphicon glyphicon-chevron-right"></span>
    </a>
    {% endif %}
{% endmacro %}

{% macro default_footer() %}
    {% include "main::passage_footer.html" %}
{% endmacro %}

{% macro show_passage(text, header, navigation, footer) %}
<article>
        {{ header }}
    <nav>
        {{ navigation }}
    </nav>
    <section>
        {{ text }}
    </section>
    <footer>
      {{ footer }}
    </footer>
</article>
{% endmacro %}

{% block article %}
    {{ show_passage(text_passage, navigation=nav(), header=header_passage(), footer=default_footer()) }}
{% endblock %}
