{% macro listPackages(packages, paginate, showAutoUpdateWarning) %}
    <ul class="packages">
        {% for package in packages %}
            <li data-url="{{ path('view_package', { 'name' : package.name }) }}">
                <h1>
                    <a href="{{ path('view_package', { 'name' : package.name }) }}">{{ package.name }}</a>
                    {% if showAutoUpdateWarning and not package.autoUpdated %}
                        [Not auto-updated]
                    {% endif %}
                </h1>
                {% if package.description %}
                    <p class="package-description">{{ package.description }}</p>
                {% endif %}
            </li>
        {% endfor %}

        {% if paginate is defined and paginate and packages.nbPages > 1 %}
            {{ pagerfanta(packages, 'default', {'proximity': 2}) }}
        {% endif %}
    </ul>
{% endmacro %}

{% macro packageLink(packageName) %}
    {%- if packageName is existing_package -%}
        <a href="{{ path('view_package', { 'name': packageName }) }}">{{ packageName }}</a>
    {%- else -%}
        {{ packageName }}
    {%- endif -%}
{% endmacro %}
