From b5d19ee4be0e4376a18df6901da973f25fe83062 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Thu, 12 Sep 2024 11:42:41 +0200 Subject: [PATCH 1/2] [Doc] Provide an alternative for the deprecated spaceless filter --- doc/filters/spaceless.rst | 3 ++- doc/templates.rst | 15 --------------- 2 files changed, 2 insertions(+), 16 deletions(-) diff --git a/doc/filters/spaceless.rst b/doc/filters/spaceless.rst index 7a8e4093e..0300faf69 100644 --- a/doc/filters/spaceless.rst +++ b/doc/filters/spaceless.rst @@ -3,7 +3,8 @@ .. warning:: - The ``spaceless`` filter is deprecated as of Twig 3.12. + The ``spaceless`` filter is deprecated as of Twig 3.12. Instead, use the + :ref:`whitespace control features `. Use the ``spaceless`` filter to remove whitespace *between HTML tags*, not whitespace within HTML tags or whitespace in plain text: diff --git a/doc/templates.rst b/doc/templates.rst index 199d40fe4..8fd5222dc 100644 --- a/doc/templates.rst +++ b/doc/templates.rst @@ -934,21 +934,6 @@ the modifiers on one side of a tag or on both sides: {{~ value }} {# outputs '
  • \nno spaces
  • ' #} -.. tip:: - - In addition to the whitespace modifiers, Twig also has a ``spaceless`` filter - that removes whitespace **between HTML tags**: - - .. code-block:: html+twig - - {% apply spaceless %} -
    - foo bar -
    - {% endapply %} - - {# output will be
    foo bar
    #} - Extensions ---------- From 5a94ddc76ee1f6d86e546feb98ee0d0ea5f4f2b1 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Sat, 14 Sep 2024 10:56:07 +0200 Subject: [PATCH 2/2] Suggest wording --- doc/filters/spaceless.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/filters/spaceless.rst b/doc/filters/spaceless.rst index 0300faf69..7fab7fb26 100644 --- a/doc/filters/spaceless.rst +++ b/doc/filters/spaceless.rst @@ -3,8 +3,8 @@ .. warning:: - The ``spaceless`` filter is deprecated as of Twig 3.12. Instead, use the - :ref:`whitespace control features `. + The ``spaceless`` filter is deprecated as of Twig 3.12. While not a full + replacement, you can check the :ref:`whitespace control features `. Use the ``spaceless`` filter to remove whitespace *between HTML tags*, not whitespace within HTML tags or whitespace in plain text: