<!-- add a subtitle -->
{% if subtitle %}
    <p class="subtitle">{{subtitle}}</p>
{% endif %}

<!-- hold images inside a well -->
<div class="scaffold well">

    <!-- set file counter integer -->
    {% set count = [1] %}

    <!-- display formatted files -->
    {% for filelist in filelists %}
        <div class="row">

            <!-- two file case -->
            {% if len(filelist) == 2 %}
                <div class="col-md-6" style="padding-top:20px;">
                <a name="A{{count|length}}"></a>
                {% raw %}
                    {% if path_exists('{% endraw %}{{dir}}/{{filelist[0].name}}{% raw %}') %}
                        {% set cp = get_embedded_config('{% endraw %}{{dir}}/{{filelist[0].name}}{% raw %}') %}
                            {% if cp.has_option('{% endraw %}{{filelist[0].name}}{% raw %}', 'title') %}{% endraw %}
                                <p class="text-center" style="font-size:18px;">
                                    <a href="#A{{count|length}}">
                                    <b>A{{count|length}}. {% raw %}{{cp.get('{% endraw %}{{filelist[0].name}}{% raw %}', 'title')}}</b>
                                    </a>
                                </p>
                            {% endif %}
                            {{ setup_template_render('{% endraw %}{{dir}}/{{filelist[0].name}}{% raw %}' , '') }}
                    {% endif %}
                {% endraw %}
                </div>
                {% set __ = count.append(1) %}
                <div class="col-md-6" style="padding-top:20px;">
                {% if filelist[1] != None %}
                    <a name="A{{count|length}}"></a>
                    {% raw %}
                    {% if path_exists('{% endraw %}{{dir}}/{{filelist[1].name}}{% raw %}') %}
                        {% set cp = get_embedded_config('{% endraw %}{{dir}}/{{filelist[1].name}}{% raw %}') %}
                            {% if cp.has_option('{% endraw %}{{filelist[1].name}}{% raw %}', 'title') %}{% endraw %}
                                <p class="text-center" style="font-size:18px;">
                                    <a href="#A{{count|length}}">
                                    <b>A{{count|length}}. {% raw %}{{cp.get('{% endraw %}{{filelist[1].name}}{% raw %}', 'title')}}</b></p>
                                    </a>
                                </p>
                            {% endif %}
                            {{ setup_template_render('{% endraw %}{{dir}}/{{filelist[1].name}}{% raw %}' , '') }}
                    {% endif %}
                    {% endraw %}
                {% endif %}
                </div>
            {% endif %}

            <!-- one file case -->
            {% if len(filelist) == 1 %}
                <div class="col-md-12" style="padding-top:20px;">
                <a name="A{{count|length}}"></a>
                    {% raw %}
                    {% if path_exists('{% endraw %}{{dir}}/{{filelist[0].name}}{% raw %}') %}
                        {% set cp = get_embedded_config('{% endraw %}{{dir}}/{{filelist[0].name}}{% raw %}') %}
                            {% if cp.has_option('{% endraw %}{{filelist[0].name}}{% raw %}', 'title') %}{% endraw %}
                                <p class="text-center" style="font-size:18px;">
                                    <a href="#A{{count|length}}">
                                    <b>A{{count|length}}. {% raw %}{{cp.get('{% endraw %}{{filelist[0].name}}{% raw %}', 'title')}}</b></p>
                                    </a>
                                </p>
                            {% endif %}
                            {{ setup_template_render('{% endraw %}{{dir}}/{{filelist[0].name}}{% raw %}' , '') }}
                    {% endif %}
                    {% endraw %}
                </div>
            {% endif %}

            <!-- increment -->
            {% set __ = count.append(1) %}

    </div>
    {% endfor %}

</div>
