{% set page = 'package-file' %}
{% set selected_package_name = package %}
{% extends '_base.html' %}
{% import '_macros.html' as macros %}

{% block title %}{{filename}} | {{package}} | PyPI Browser{% endblock %}

{% block content %}
    <h1 class="font-monospace">{{filename}}</h1>

    <nav aria-label="breadcrumb">
        <ol class="breadcrumb">
            <li class="breadcrumb-item"><a href="{{url_for('home')}}">Browse</a></li>
            <li class="breadcrumb-item">
                <a
                    href="{{url_for('package', package=package)}}"
                >
                    {{package}}
                </a>
            </li>
            <li class="breadcrumb-item active">{{filename}}</li>
        </ol>
    </nav>

    <h5>{{macros.package_type_pill(filename)}}</h5>

    {{macros.tarball_warning(package_is_tarball)}}

    {% if metadata_path %}
        <h4>Package Metadata</h4>
        <table class="table table-bordered table-sm small metadata">
            <caption>
                Metadata parsed from
                <a class="font-monospace" href="{{url_for('package_file_archive_path', package=package, filename=filename, archive_path=metadata_path)}}">
                    {{metadata_path}}
                </a>
            </caption>
            {% for key, values in metadata.items()|sort %}
                {% for value in values %}
                    <tr>
                        {% if loop.index == 1 %}
                            <th rowspan="{{values|length}}">{{key}}</th>
                        {% endif %}
                        <td class="font-monospace">{{value}}</td>
                    </tr>
                {% endfor %}
            {% endfor %}
        </table>
    {% endif %}

    <h4>Package Files</h4>
    <p class="small">Click a file name below to view its contents.</p>
    <div class="card bg-light mb-3">
        <div class="list-group list-group-flush">
            {% for entry in entries|sort(attribute="path") %}
                <a
                    class="list-group-item list-group-item-action small"
                    href="{{url_for('package_file_archive_path', package=package, filename=filename, archive_path=entry.path)}}"
                >
                    <span class="font-monospace">
                        {{entry.path}}
                    </span>
                    {{entry.size|human_size}}
                </a>
            {% endfor %}
        </div>
    </div>
{% endblock %}

{# vim: ft=jinja
#}
