{% load i18n cms_tags %}{% spaceless %}

<div class="nested-item nested-item--{{ instance.variant }} nested-item--{{ nesting_level }}">
    {% if parent_variant == "accordion" and instance.child_plugin_instances %}
        <button class="nested-item__title" data-accordion-button>
            {{ instance.content }}
        </button>
    {% elif instance.content %}
        <div class="nested-item__content">
            {{ instance.content|linebreaksbr }}
        </div>
    {% endif %}

    {% if instance.child_plugin_instances %}
        <ul class="nested-item__items">
            {% for plugin in instance.child_plugin_instances %}
                <li>
                    {% with nesting_level=nesting_level|add:1 parent_variant=instance.variant %}
                        {% render_plugin plugin %}
                    {% endwith %}
                </li>
            {% endfor %}
        </ul>
    {% endif %}
</div>

{% endspaceless %}
