{# this template is used to render the top-level index.html. #}
{% if root_module_name %}
{#
If there is one common parent module for all documented modules, redirect there immediately.
This makes a package's `__init__.py` the main entrypoint by default.
A custom template could override this by setting root_module_name to false before `{% extend ... %}`.
#}
<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="refresh" content="0; url=./{{ root_module_name.replace(".","/") }}.html"/>
</head>
</html>
{% else %}
{% extends "frame.html.jinja2" %}
{% block title %}Module List &ndash; pdoc {{ __version__ }}{% endblock %}
{% block style %}
    {{ super() | safe }}
    <style>
        header.pdoc {
            display: flex;
            align-items: center;
            flex-wrap: wrap;
        }

        header.pdoc img {
            max-width: 200px;
            max-height: 75px;
            padding-right: 2rem;
        }

        header.pdoc input[type=search] {
            outline-offset: 0;
            font-size: 1.5rem;
            min-width: 60%;
            flex-grow: 1;
            padding-left: .5rem;
            margin: 1.75rem 0;
        }
    </style>
{% endblock %}
{% block nav %}
    <h2>Available Modules</h2>
    <ul>
        {% for submodule in all_modules if "._" not in submodule and not submodule.startswith("_") %}
            <li><a href="{{ submodule.replace(".","/") }}.html">{{ submodule }}</a></li>
        {% endfor %}
    </ul>
{% endblock %}
{% block content %}
    <header class="pdoc">
        {% block logo %}
            {% if logo %}
                {% if logo_link %}<a href="{{ logo_link }}">{% endif %}
                <img src="{{ logo }}" alt="project logo"/>
                {% if logo_link %}</a>{% endif %}
            {% else %}
                <a href="https://pdoc.dev">
                    <img src="data:image/svg+xml,{% filter urlencode %}{% include "resources/pdoc-logo.svg" %}{% endfilter %}"
                         alt="pdoc"/>
                </a>
            {% endif %}
        {% endblock %}
        {% if search %}
            <input type="search" placeholder="Search API Documentation..." aria-label="search box">
        {% endif %}
    </header>
    <main class="pdoc"></main>
    {% if search %}
        {% include "search.html.jinja2" %}
    {% endif %}
{% endblock %}
{% endif %}
