{% macro friendly_tabs(headers, contents) -%}
<div class="friendly-tabs group-{{ group }}">
    <!-- start headers -->
    <ul class="nav nav-tabs">
        {% for header in headers %}
        <li role="presentation" class="header-{{ group }}-{{ loop.index0 }} {{ header.active_class }}">
            <a href="#content-{{ group}}-{{ loop.index0 }}" data-toggle="tab">{{ header.title }}</a>
        </li>
        {% endfor %}
    </ul>
    <!-- end headers -->
    <!-- start contents -->
    <div class="tab-content">
        {% for content in contents %}
        <div id="content-{{ group }}-{{ loop.index0 }}" class="tab-pane contents_item {{ content.active_class }}">
            <pre><code>{{ content.code }}</code></pre>
        </div>
        {% endfor %}
    </div>
    <!-- end contents -->
</div>
{%- endmacro %}

{% if headers|length > 1 %}
   {{ friendly_tabs(headers, contents) }}
{% else %}
    {% if friendly_config.single_block_as_tab %}
        {{ friendly_tabs(headers, contents) }}
    {% else %}
        {% for content in contents %}
            <pre><code>{{ content.code }}</code></pre>
        {% endfor %}
    {% endif %}
{% endif %}

