{% from "schema_templates/schema_macros.jinja2" import badge %}

<p>
    {{ badge("secondary", "Examples:" if examples|length > 1 else "Example:", "") }}
</p>

{% for example in examples %}
    {% set example_id = schema.html_id ~ "_ex" ~ loop.index %}
    {% set example_is_long = example is not description_short %}
    {% if example_is_long %}
        <button class="btn btn-light example-show collapsed" data-toggle="collapse" data-target="#{{ example_id }}"
                aria-controls="{{ example_id }}"></button>
    {% endif %}
    <div id="{{ example_id }}" class="{% if example_is_long %}collapse {% endif %}jumbotron examples">
        <pre><code class="language-js hljs">{{ example | safe }}</code></pre>
    </div>
{% endfor %}
