{# @deprecated tag:v6.6.0 - Template file will be removed without replacement. Corresponding JS-Plugin "ellipsis.plugin.js" is not used anymore #}

{% if truncateChars is not defined %}
    {% set truncateChars = 100 %}
{% endif %}

{% if truncateNewlines is not defined %}
    {% set truncateNewlines = 4 %}
{% endif %}

{% if text|length > truncateChars or text|split('\n')|length > truncateNewlines %}
    {% block swag_ellipsis %}
        <div data-ellipsis>

            {% block swag_ellipsis_truncated %}
                <span class="swag-ellipsis-span">

                    {{ text|slice(0, truncateChars)|split('\n')|slice(0, truncateNewlines)|join('\n')|nl2br }}...
                    {% block swag_ellipsis_truncated_expand %}
                        <a href="#" class="swag-ellipsis-expand-link">
                            {{ "ellipsis.expandLabel"|trans }}
                        </a>
                    {% endblock %}
                </span>
            {% endblock %}

            {% block swag_ellipsis_full %}
                <span class="swag-ellipsis-total-span">

                    {{ text|nl2br }}
                    {% block swag_ellipsis_truncated_shrink %}
                        <a href="#" class="swag-ellipsis-shrink-link">
                            {{ "ellipsis.shrinkLabel"|trans }}
                        </a>
                    {% endblock %}
                </span>
            {% endblock %}
        </div>
    {% endblock %}
{% else %}
    {% block swag_ellipsis_default %}
        {{ text|nl2br }}
    {% endblock %}
{% endif %}
