{% extends 'base.html.j2' %}
{% set page_title = source.name %}
{% block page_content %}
    {% include 'meta/source.html.j2' %}
    {% set sources = [source] + source | walk('contains') | list %}
    {% set have_files = sources %}
    {% set have_files = have_files + sources | map(attribute='citations') | flatten | list %}
    {% set files = have_files | map(attribute='files') | flatten | list | unique | list %}
    {% if files | length > 0 %}
        <h2>{% trans %}Media{% endtrans %}</h2>
        {% include 'list-file.html.j2' %}
    {% endif %}
    {% set facts = sources | map(attribute='citations') | flatten | map(attribute='facts') | flatten | select('resource') | unique | list %}
    {% if facts | length > 0 %}
        <h2>{% trans %}Facts{% endtrans %}</h2>
        <ul class="entities">
            {% for fact in facts %}
                <li class="{{ loop.cycle('odd', 'even') }}">
                    {% with resource=fact, source_context=source %}
                        {% include 'label/resource.html.j2' %}
                        {% include 'meta/resource.html.j2' %}
                {% endwith %}
                </li>
            {% endfor %}
        </ul>
    {% endif %}
{% endblock %}