{%- set navlevel = navlevel + 1%}
<li class="{% if nav_item.active%}current{%endif%} toctree-l{{navlevel}}">
  <a href="{{ nav_item.url }}" title="{{ nav_item.title }}"
      class="{% if nav_item.active%}current{%endif%}">
    {{ nav_item.title }}
  </a>

  {#| Children are only added to the currently selected root item |#}
  {% if nav_item.active %}
    {% if nav_item.children %}
      <ul class="{% if nav_item.active%}current{%endif%} subnav">
        {% for nav_item in nav_item.children %}
          {% include "nav-item.html" %}
        {% endfor %}
      </ul>
    {% endif %}
    {% if not nav_item.children %}
      {% include "toc.html" %}
    {% endif %}
  {% endif %}
</li>
