{{ log.debug() }}
{% if obj.children %}

  <div class="doc doc-children">

    {% if config.group_by_category %}

      {% with %}

        {% if config.show_category_heading %}
          {% set extra_level = 1 %}
        {% else %}
          {% set extra_level = 0 %}
        {% endif %}

        {% if config.show_category_heading and obj.attributes|any("has_contents") %}
          {% filter heading(heading_level, id=html_id ~ "-attributes") %}Attributes{% endfilter %}
        {% endif %}
        {% with heading_level = heading_level + extra_level %}
          {% for attribute in obj.attributes %}
            {% include "attribute.html" with context %}
          {% endfor %}
        {% endwith %}

        {% if config.show_category_heading and obj.classes|any("has_contents") %}
          {% filter heading(heading_level, id=html_id ~ "-classes") %}Classes{% endfilter %}
        {% endif %}
        {% with heading_level = heading_level + extra_level %}
          {% for class in obj.classes %}
            {% include "class.html" with context %}
          {% endfor %}
        {% endwith %}

        {% if config.show_category_heading and obj.functions|any("has_contents") %}
          {% filter heading(heading_level, id=html_id ~ "-functions") %}Functions{% endfilter %}
        {% endif %}
        {% with heading_level = heading_level + extra_level %}
          {% for function in obj.functions %}
            {% include "function.html" with context %}
          {% endfor %}
        {% endwith %}

        {% if config.show_category_heading and obj.methods|any("has_contents") %}
          {% filter heading(heading_level, id=html_id ~ "-methods") %}Methods{% endfilter %}
        {% endif %}
        {% with heading_level = heading_level + extra_level %}
          {% for method in obj.methods %}
            {% include "method.html" with context %}
          {% endfor %}
        {% endwith %}

        {% if config.show_category_heading and obj.modules|any("has_contents") %}
          {% filter heading(heading_level, id=html_id ~ "-modules") %}Modules{% endfilter %}
        {% endif %}
        {% with heading_level = heading_level + extra_level %}
          {% for module in obj.modules %}
            {% include "module.html" with context %}
          {% endfor %}
        {% endwith %}

      {% endwith %}

    {% else %}

      {% for child in obj.children %}
        {% if child.category == "attribute" %}
          {% with attribute = child %}
            {% include "attribute.html" with context %}
          {% endwith %}

        {% elif child.category == "class" %}
          {% with class = child %}
            {% include "class.html" with context %}
          {% endwith %}

        {% elif child.category == "function" %}
          {% with function = child %}
            {% include "function.html" with context %}
          {% endwith %}

        {% elif child.category == "method" %}
          {% with method = child %}
            {% include "method.html" with context %}
          {% endwith %}

        {% elif child.category == "module" %}
          {% with module = child %}
            {% include "module.html" with context %}
          {% endwith %}

        {% endif %}

      {% endfor %}

    {% endif %}

  </div>

{% endif %}
