{% macro bs_filters(
    filter_title,
    filter_display,
    heading,
    format_str='There is no "%(heading)s" to display.',
    format_str_filters='There is no "%(heading)s" with %(filters_str)s to display.') -%}

{% set filters_str -%}
    {% for filter_field, filters in filter_display.items() -%}
        {% if filters|length > 0 -%}
            <badge-primary>{{ filter_title[filter_field] }}</badge-primary>
            {% for filter_name in filters -%}
                <label-info>{{ filter_name }}</label-info>
            {% endfor -%}
        {% endif -%}
    {% endfor -%}
{% endset -%}

{% if filters_str != '' -%}
        {{ _(format_str_filters, heading=heading, filters_str=mark_safe(filters_str)) }}
{% else -%}
    {{ _(format_str, heading=heading) }}
{% endif -%}

{% endmacro -%}
{% if _render_ -%}
    {{ bs_filters(**_render_) }}
{% endif -%}
