{% for caption, menus in context.plugins.Menu.menu.main %}
  <p class="caption"><span class="caption-text">{{ caption }}</span></p>
  {% for section_l1, menus_l1 in menus %}
    <ul>
      <li class="toctree-l1{% if is_active(section_l1, menus_l1, content) %} current{% endif %}">
        {% if section_l1.content %}
          <a href="{{ section_l1.content.url }}" class="reference internal">{{ section_l1.name }}</a>
        {% else %}
          <a href="{{ menus_l1.url }}" class="reference internal">{{ section_l1 }}</a>
        {% endif %}
        {% if is_list(menus_l1) %}
          <ul{% if is_active(section_l1, menus_l1, content) %} class="current"{% endif %}>
            {% for section_l2, menus_l2 in menus_l1 %}
              <li class="toctree-l2{% if is_active(section_l2, menus_l2, content) %} current{% endif %}">
                {% if section_l2.content %}
                  <a href="{{ section_l2.content.url }}" class="reference internal">{{ section_l2.name }}</a>
                {% else %}
                  <a href="{{ menus_l2.url }}" class="reference internal">{{ section_l2 }}</a>
                {% endif %}
                {% if is_list(menus_l2) %}
                  <ul{% if is_active(section_l2, menus_l2, content) %} class="current"{% endif %}>
                    {% for section_l3, menus_l3 in menus_l2 %}
                      <li class="toctree-l3{% if is_active(section_l3, menus_l3, content) %} current{% endif %}">
                        {% if section_l3.content %}
                          <a href="{{ section_l3.content.url }}" class="reference internal">{{ section_l3.name }}</a>
                        {% else %}
                          <a href="{{ menus_l3.url }}" class="reference internal">{{ section_l3 }}</a>
                        {% endif %}
                      </li>
                    {% endfor %}
                  </ul>
                {% endif %}
              </li>
            {% endfor %}
          </ul>
        {% endif %}
      </li>
    </ul>
  {% endfor %}
{% endfor %}
