{% macro render_announcement_legacy(type, message, persistent=false) %}
    {% if type == 'html' %}
        {{ message | safe }}
    {% else %}
        <div class="announcement-bar {{ type }}" hidden data-hash="{{ message | crc32 }}">
            <div class="flexrow f-self-stretch f-j-center f-a-center">
                <i class="icon icon-warning"></i>
                <div>
                    {{ message | safe }}
                </div>
            </div>
            {% if not persistent %}
                <button class="close-button">
                    <span>{% trans %}Dismiss{% endtrans %}</span>
                </button>
            {% endif %}
        </div>
    {% endif %}
{% endmacro %}

{% macro render_announcement_new(type, message, persistent=false) %}
    {% if type == 'html' %}
        {{ message | safe }}
    {% else %}
        <div class="announcement-bar {{ type }}" hidden data-hash="{{ message | crc32 }}">
            <div class="content">
                <i class="warning sign large icon"></i>
                <div class="message">
                    {{ message | safe }}
                </div>
            </div>
            {% if not persistent %}
                <button class="close-button">
                    <i class="icon close"></i>
                    <span class="close-button-label">
                        {% trans %}Dismiss{% endtrans %}
                    </span>
                </button>
            {% endif %}
        </div>
    {% endif %}
{% endmacro %}

{% macro render_announcements(legacy=false) %}
    <div class="announcements" aria-live="assertive">
        {% set announcements = template_hook('global-announcement', as_list=true) %}
        {% for announcement in announcements %}
            {% if legacy %}
                {{ render_announcement_legacy(*announcement) }}
            {% else %}
                {{ render_announcement_new(*announcement) }}
            {% endif %}
        {% endfor %}
    </div>
{% endmacro %}
