{#
    This component outputs a semantic headline.

        <h1>headline</h1>

    Mandatory variables:
        @var string text

    Optional variables:
        @var string tag_name
        @var \Contao\CoreBundle\String\HtmlAttributes attributes

    Note:
        You can either group all variables in an object named "headline" or
        all directly in the context. Grouping under an object has precedence.
#}

{% block headline_component %}
    {% set headline = headline|default(_context) %}
    {% set tag_name = headline.tag_name|default('h1') %}

    <{{ tag_name }}{% block headline_attributes %}{{ headline.attributes|default }}{% endblock %}>
    {%- block headline_inner -%}
        {%- if as_editor_view -%}
            {{ headline.text }}
        {%- else -%}
            {%- if (data.subline) and (data.subheadline is not same as('1')) -%}
                <span class="first-headline{%- if data.headline_inline is not same as('1') -%}{{ ' block' }}{%- endif -%}">{{ data.subline }}</span>
                {%- if data.headline_inline is same as('1') -%}{{ ' ' }}{%- endif -%}
            {%- endif -%}
            {%- if data.subline -%}<span class="main-headline">{%- endif -%}
            {{ headline.text|insert_tag_raw }}
            {%- if data.subline -%}</span>{%- endif -%}
            {%- if data.subheadline -%}
                <span class="subheadline block">{{ data.subline }}</span>
            {%- endif -%}
        {%- endif -%}
    {%- endblock -%}
    </{{ tag_name }}>
{% endblock %}
