new-horizons/docs/content/base/section_examples.jinja2
2022-03-02 23:24:17 -05:00

19 lines
771 B
Django/Jinja

<br/>
<div class="badge badge-secondary">Example{% if examples|length > 1 %}s{% endif %}:</div>
<br/>
{% 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">
{% if not examples_as_yaml %}
{{ example | highlight_json_example }}
{% else %}
{{ example | highlight_yaml_example }}
{% endif %}
</div>
{% endfor %}