{% macro renderClass(name, modifiers, classes) %}
    {{- name|trim -}}
    {%- if modifiers is iterable and modifiers is not empty %}
        {%- for modifier in modifiers -%}
            {%- if modifier|trim is not empty %}
                {{ name }}--{{ modifier|trim }}
            {% endif -%}
        {% endfor -%}
    {% endif -%}
    {%- if classes is not empty %}
        {{- ' ' ~ (classes|trim) -}}
    {% endif -%}
{%- endmacro -%}

{% macro renderAttributes(attributes) %}
    {% apply spaceless %}
    {% if attributes is iterable and attributes is not empty %}
        {%- for name, value in attributes -%}
            {% set valueWithData = value is defined
                and value is not empty
                and value is not same as(false)
            %}
            {%- if value is same as(true) -%}
                {{- ' ' ~ name -}}
            {%- elseif valueWithData -%}
                {{- ' ' ~ name -}}='{{- value -}}'
            {%- endif -%}
        {%- endfor -%}
    {% endif %}
    {% endapply %}
{%- endmacro -%}

{% macro renderPrefixedAttributes(prefix, attributes) %}
    {% if attributes is iterable and attributes is not empty %}
        {%- for name, value in attributes -%}
            {%- if value is same as(true) -%}
                {{- ' ' ~ prefix ~ '-' ~ name -}}
            {%- elseif value is not same as(false) -%}
                {{- ' ' ~ prefix ~ '-' ~ name -}}='{{- value -}}'
            {%- endif -%}
        {%- endfor -%}
    {% endif %}
{%- endmacro -%}
