{% apply spaceless %}
  {# VARIABLES #}
  {% set attributes = attributes|default(create_attribute()) %}

  {# Sometimes attributes is array not a proper Attributes class #}
  {% if attributes is iterable %}
    {% set new_attributes = create_attribute() %}
    {% for k, v in attributes %}
      {% set new_attributes = new_attributes.setAttribute(k, v) %}
    {% endfor %}
    {% set attributes = new_attributes %}
  {% endif %}

  {% set tag_name = 'span' %}
  {% if url is not empty %}
    {% set attributes = attributes.setAttribute('href', url) %}
    {% set tag_name = 'a' %}
  {% endif %}

  {# TEMPLATE #}
  <{{ tag_name }} {{ attributes.addClass('stdl').addClass(class) }}>{{ text|raw }}</{{ tag_name }}>
{% endapply %}
