{% extends 'base.html' %}

{% set prefix = compound.prefix_wbr %}

{% macro entry_module(module) %}{% include 'entry-module.html' %}{% endmacro %}
{% macro entry_dir(dir) %}{% include 'entry-dir.html' %}{% endmacro %}
{% macro entry_file(file) %}{% include 'entry-file.html' %}{% endmacro %}
{% macro entry_namespace(namespace) %}{% include 'entry-namespace.html' %}{% endmacro %}
{% macro entry_class(class) %}{% include 'entry-class.html' %}{% endmacro %}
{% macro entry_enum(enum) %}{% include 'entry-enum.html' %}{% endmacro %}
{% macro entry_typedef(typedef) %}{% include 'entry-typedef.html' %}{% endmacro %}
{% macro entry_func(func) %}{% include 'entry-func.html' %}{% endmacro %}
{% macro entry_var(var) %}{% include 'entry-var.html' %}{% endmacro %}
{% macro entry_define(define) %}{% include 'entry-define.html' %}{% endmacro %}

{% macro details_enum(enum) %}{% include 'details-enum.html' %}{% endmacro %}
{% macro details_typedef(typedef) %}{% include 'details-typedef.html' %}{% endmacro %}
{% macro details_func(func) %}{% include 'details-func.html' %}{% endmacro %}
{% macro details_var(var) %}{% include 'details-var.html' %}{% endmacro %}
{% macro details_define(define) %}{% include 'details-define.html' %}{% endmacro %}

{% block main %}
{% block header %}
{% endblock %}
        {% if compound.brief %}
        <p>{{ compound.brief }}</p>
        {% endif %}
        {% if compound.sections or compound.modules or compound.dirs or compound.files or compound.namespaces or compound.classes or compound.typedefs or compound.funcs or compound.vars or compound.defines or compound.groups %}
        <nav class="m-block m-default">
          <h3>Contents</h3>
          <ul>
            {% for id, name, children in compound.sections recursive %}
            {% if children %}
            <li>
              <a href="#{{ id }}">{{ name }}</a>
              <ul>
{{ loop(children)|rtrim|indent(4, true) }}
              </ul>
            </li>
            {% else %}
            <li><a href="#{{ id }}">{{ name }}</a></li>
            {% endif %}
            {% endfor %}
            {% if compound.modules or compound.dirs or compound.files or compound.namespaces or compound.classes or compound.typedefs or compound.funcs or compound.vars or compound.defines or compound.groups %}
            <li>
              Reference
              <ul>
                {% if compound.modules %}
                <li><a href="#groups">Modules</a></li>
                {% endif %}
                {% if compound.dirs %}
                <li><a href="#subdirs">Directories</a></li>
                {% endif %}
                {% if compound.files %}
                <li><a href="#files">Files</a></li>
                {% endif %}
                {% if compound.namespaces %}
                <li><a href="#namespaces">Namespaces</a></li>
                {% endif %}
                {% if compound.classes %}
                <li><a href="#nested-classes">Classes</a></li>
                {% endif %}
                {% if compound.enums %}
                <li><a href="#enum-members">Enums</a></li>
                {% endif %}
                {% if compound.typedefs %}
                <li><a href="#typedef-members">Typedefs</a></li>
                {% endif %}
                {% if compound.funcs %}
                <li><a href="#func-members">Functions</a></li>
                {% endif %}
                {% if compound.vars %}
                <li><a href="#var-members">Variables</a></li>
                {% endif %}
                {% if compound.defines %}
                <li><a href="#define-members">Defines</a></li>
                {% endif %}
                {% for group in compound.groups %}
                <li><a href="#{{ group.id }}">{{ group.name }}</a></li>
                {% endfor %}
              </ul>
            </li>
            {% endif %}
          </ul>
        </nav>
        {% endif %}
{% if compound.description %}
{{ compound.description }}
{% endif %}
        {% if compound.modules %}
        <section id="groups">
          <h2><a href="#groups">Modules</a></h2>
          <dl class="m-doc">
            {% for module in compound.modules %}
{{ entry_module(module) }}
            {% endfor %}
          </dl>
        </section>
        {% endif %}
        {% if compound.dirs %}
        <section id="subdirs">
          <h2><a href="#subdirs">Directories</a></h2>
          <dl class="m-doc">
            {% for dir in compound.dirs %}
{{ entry_dir(dir) }}
            {% endfor %}
          </dl>
        </section>
        {% endif %}
        {% if compound.files %}
        <section id="files">
          <h2><a href="#files">Files</a></h2>
          <dl class="m-doc">
            {% for file in compound.files %}
{{ entry_file(file) }}
            {% endfor %}
          </dl>
        </section>
        {% endif %}
        {% if compound.namespaces %}
        <section id="namespaces">
          <h2><a href="#namespaces">Namespaces</a></h2>
          <dl class="m-doc">
            {% for namespace in compound.namespaces %}
{{ entry_namespace(namespace) }}
            {% endfor %}
          </dl>
        </section>
        {% endif %}
        {% if compound.classes %}
        <section id="nested-classes">
          <h2><a href="#nested-classes">Classes</a></h2>
          <dl class="m-doc">
            {% for class in compound.classes %}
{{ entry_class(class) }}
            {% endfor %}
          </dl>
        </section>
        {% endif %}
        {% if compound.enums %}
        <section id="enum-members">
          <h2><a href="#enum-members">Enums</a></h2>
          <dl class="m-doc">
            {% for enum in compound.enums %}
{{ entry_enum(enum) }}
            {% endfor %}
          </dl>
        </section>
        {% endif %}
        {% if compound.typedefs %}
        <section id="typedef-members">
          <h2><a href="#typedef-members">Typedefs</a></h2>
          <dl class="m-doc">
            {% for typedef in compound.typedefs %}
{{ entry_typedef(typedef) }}
            {% endfor %}
          </dl>
        </section>
        {% endif %}
        {% if compound.funcs %}
        <section id="func-members">
          <h2><a href="#func-members">Functions</a></h2>
          <dl class="m-doc">
            {% for func in compound.funcs %}
{{ entry_func(func) }}
            {% endfor %}
          </dl>
        </section>
        {% endif %}
        {% if compound.vars %}
        <section id="var-members">
          <h2><a href="#var-members">Variables</a></h2>
          <dl class="m-doc">
            {% for var in compound.vars %}
{{ entry_var(var) }}
            {% endfor %}
          </dl>
        </section>
        {% endif %}
        {% if compound.defines %}
        <section id="define-members">
          <h2><a href="#define-members">Defines</a></h2>
          <dl class="m-doc">
            {% for define in compound.defines %}
{{ entry_define(define) }}
            {% endfor %}
          </dl>
        </section>
        {% endif %}
        {% for group in compound.groups %}
        <section id="{{ group.id }}">
          <h2><a href="#{{ group.id }}">{{ group.name }}</a></h2>
          {% if group.description %}
{{ group.description }}
          {% endif %}
          <dl class="m-doc">
            {% for kind, member in group.members %}
            {% if kind == 'namespace' %}
{{ entry_namespace(member) }}
            {% elif kind == 'class' %}
{{ entry_class(member) }}
            {% elif kind == 'enum' %}
{{ entry_enum(member) }}
            {% elif kind == 'typedef' %}
{{ entry_typedef(member) }}
            {% elif kind == 'func' %}
{{ entry_func(member) }}
            {% elif kind == 'var' %}
{{ entry_var(member) }}
            {% elif kind == 'define' %}
{{ entry_define(member) }}
            {% endif %}
            {% endfor %}
          </dl>
        </section>
        {% endfor %}
        {% if compound.has_enum_details %}
        <section>
          <h2>Enum documentation</h2>
          {% for enum in compound.enums %}
          {% if enum.has_details %}
{{ details_enum(enum) }}
          {% endif %}
          {% endfor %}
          {% for group in compound.groups %}
          {% for kind, member in group.members %}
          {% if kind == 'enum' and member.has_details %}
{{ details_enum(member) }}
          {% endif %}
          {% endfor %}
          {% endfor %}
        </section>
        {% endif %}
        {% if compound.has_typedef_details %}
        <section>
          <h2>Typedef documentation</h2>
          {% for typedef in compound.typedefs %}
          {% if typedef.has_details %}
{{ details_typedef(typedef) }}
          {% endif %}
          {% endfor %}
          {% for group in compound.groups %}
          {% for kind, member in group.members %}
          {% if kind == 'typedef' and member.has_details %}
{{ details_typedef(member) }}
          {% endif %}
          {% endfor %}
          {% endfor %}
        </section>
        {% endif %}
        {% if compound.has_func_details %}
        <section>
          <h2>Function documentation</h2>
          {% for func in compound.funcs %}
          {% if func.has_details %}
{{ details_func(func) }}
          {% endif %}
          {% endfor %}
          {% for group in compound.groups %}
          {% for kind, member in group.members %}
          {% if kind == 'func' and member.has_details %}
{{ details_func(member) }}
          {% endif %}
          {% endfor %}
          {% endfor %}
        </section>
        {% endif %}
        {% if compound.has_var_details %}
        <section>
          <h2>Variable documentation</h2>
          {% for var in compound.vars %}
          {% if var.has_details %}
{{ details_var(var) }}
          {% endif %}
          {% endfor %}
          {% for group in compound.groups %}
          {% for kind, member in group.members %}
          {% if kind == 'var' and member.has_details %}
{{ details_var(member) }}
          {% endif %}
          {% endfor %}
          {% endfor %}
        </section>
        {% endif %}
        {% if compound.has_define_details %}
        <section>
          <h2>Define documentation</h2>
          {% for define in compound.defines %}
          {% if define.has_details %}
{{ details_define(define) }}
          {% endif %}
          {% endfor %}
          {% for group in compound.groups %}
          {% for kind, member in group.members %}
          {% if kind == 'define' and member.has_details %}
{{ details_define(member) }}
          {% endif %}
          {% endfor %}
          {% endfor %}
        </section>
        {% endif %}
{% endblock %}
