diff --git a/doc/.doctor-rst.yaml b/doc/.doctor-rst.yaml
index 1004e138c..d0f833d3c 100644
--- a/doc/.doctor-rst.yaml
+++ b/doc/.doctor-rst.yaml
@@ -37,18 +37,17 @@ rules:
yarn_dev_option_at_the_end: ~
versionadded_directive_major_version:
- major_version: 1
+ major_version: 2
versionadded_directive_min_version:
- min_version: '1.0'
+ min_version: '2.0'
deprecated_directive_major_version:
- major_version: 1
+ major_version: 2
deprecated_directive_min_version:
- min_version: '1.0'
+ min_version: '2.0'
whitelist:
lines:
- - '``C:\\php-sdk\\phpdev\\vcXX\\x86\\php-source-directory\\Release``'
- 'I like Twig. '
diff --git a/doc/advanced.rst b/doc/advanced.rst
index db178baec..41fd156bc 100644
--- a/doc/advanced.rst
+++ b/doc/advanced.rst
@@ -365,6 +365,7 @@ tests also have access to the ``arguments`` node. This node will contain the
various other arguments that have been provided to your test.
.. versionadded:: 2.6
+
Dynamic tests support was added in Twig 2.6.
If you want to pass a variable number of positional or named arguments to the
diff --git a/doc/filters/column.rst b/doc/filters/column.rst
index 97a3037dc..6808167b1 100644
--- a/doc/filters/column.rst
+++ b/doc/filters/column.rst
@@ -2,6 +2,7 @@
==========
.. versionadded:: 2.8
+
The ``column`` filter was added in Twig 2.8.
The ``column`` filter returns the values from a single column in the input
diff --git a/doc/filters/country_name.rst b/doc/filters/country_name.rst
index 4dd72624e..f8ebbaf7b 100644
--- a/doc/filters/country_name.rst
+++ b/doc/filters/country_name.rst
@@ -2,6 +2,7 @@
================
.. versionadded:: 2.12
+
The ``country_name`` filter was added in Twig 2.12.
The ``country_name`` filter returns the country name given its ISO-3166
@@ -26,7 +27,7 @@ By default, the filter uses the current locale. You can pass it explicitly:
.. code-block:: bash
- $ composer req twig/intl-extra
+ $ composer require twig/intl-extra
Then, use the ``twig/extra-bundle`` on Symfony projects or add the extension
explicitly on the Twig environment::
diff --git a/doc/filters/currency_name.rst b/doc/filters/currency_name.rst
index a5ee46914..2b48107f0 100644
--- a/doc/filters/currency_name.rst
+++ b/doc/filters/currency_name.rst
@@ -2,6 +2,7 @@
=================
.. versionadded:: 2.12
+
The ``currency_name`` filter was added in Twig 2.12.
The ``currency_name`` filter returns the currency name given its three-letter
@@ -29,7 +30,7 @@ By default, the filter uses the current locale. You can pass it explicitly:
.. code-block:: bash
- $ composer req twig/intl-extra
+ $ composer require twig/intl-extra
Then, use the ``twig/extra-bundle`` on Symfony projects or add the extension
explicitly on the Twig environment::
diff --git a/doc/filters/currency_symbol.rst b/doc/filters/currency_symbol.rst
index a0f132638..4cb60feb4 100644
--- a/doc/filters/currency_symbol.rst
+++ b/doc/filters/currency_symbol.rst
@@ -2,6 +2,7 @@
===================
.. versionadded:: 2.12
+
The ``currency_symbol`` filter was added in Twig 2.12.
The ``currency_symbol`` filter returns the currency symbol given its three-letter
@@ -29,7 +30,7 @@ By default, the filter uses the current locale. You can pass it explicitly:
.. code-block:: bash
- $ composer req twig/intl-extra
+ $ composer require twig/intl-extra
Then, use the ``twig/extra-bundle`` on Symfony projects or add the extension
explicitly on the Twig environment::
diff --git a/doc/filters/data_uri.rst b/doc/filters/data_uri.rst
index 8ab4d589e..afbf4e2fe 100644
--- a/doc/filters/data_uri.rst
+++ b/doc/filters/data_uri.rst
@@ -2,12 +2,13 @@
============
.. versionadded:: 2.12
+
The ``data_uri`` filter was added in Twig 2.12.
The ``data_uri`` filter generates a URL using the data scheme as defined in RFC
2397:
-.. code-block:: twig
+.. code-block:: html+twig
{{ image_data|data_uri }}
@@ -29,7 +30,7 @@ The ``data_uri`` filter generates a URL using the data scheme as defined in RFC
.. code-block:: bash
- $ composer req twig/html-extra
+ $ composer require twig/html-extra
Then, use the ``twig/extra-bundle`` on Symfony projects or add the extension
explicitly on the Twig environment::
diff --git a/doc/filters/format_currency.rst b/doc/filters/format_currency.rst
index a76d9d9d6..9c254a91a 100644
--- a/doc/filters/format_currency.rst
+++ b/doc/filters/format_currency.rst
@@ -2,6 +2,7 @@
===================
.. versionadded:: 2.12
+
The ``format_currency`` filter was added in Twig 2.12.
The ``format_currency`` filter formats a number as a currency:
@@ -57,7 +58,7 @@ By default, the filter uses the current locale. You can pass it explicitly:
.. code-block:: bash
- $ composer req twig/intl-extra
+ $ composer require twig/intl-extra
Then, use the ``twig/extra-bundle`` on Symfony projects or add the extension
explicitly on the Twig environment::
diff --git a/doc/filters/format_date.rst b/doc/filters/format_date.rst
index 5ae4fcb31..1fa1a9147 100644
--- a/doc/filters/format_date.rst
+++ b/doc/filters/format_date.rst
@@ -2,6 +2,7 @@
===============
.. versionadded:: 2.12
+
The ``format_date`` filter was added in Twig 2.12.
The ``format_date`` filter formats a date. It behaves in the exact same way as
@@ -14,7 +15,7 @@ the :doc:`format_datetime` filter, but without the time.
.. code-block:: bash
- $ composer req twig/intl-extra
+ $ composer require twig/intl-extra
Then, use the ``twig/extra-bundle`` on Symfony projects or add the extension
explicitly on the Twig environment::
diff --git a/doc/filters/format_datetime.rst b/doc/filters/format_datetime.rst
index 94611ef74..8f11b7dc8 100644
--- a/doc/filters/format_datetime.rst
+++ b/doc/filters/format_datetime.rst
@@ -2,6 +2,7 @@
===================
.. versionadded:: 2.12
+
The ``format_datetime`` filter was added in Twig 2.12.
The ``format_datetime`` filter formats a date time:
@@ -52,7 +53,7 @@ By default, the filter uses the current locale. You can pass it explicitly:
.. code-block:: bash
- $ composer req twig/intl-extra
+ $ composer require twig/intl-extra
Then, use the ``twig/extra-bundle`` on Symfony projects or add the extension
explicitly on the Twig environment::
diff --git a/doc/filters/format_number.rst b/doc/filters/format_number.rst
index 06e7d7791..7864f081d 100644
--- a/doc/filters/format_number.rst
+++ b/doc/filters/format_number.rst
@@ -2,6 +2,7 @@
=================
.. versionadded:: 2.12
+
The ``format_number`` filter was added in Twig 2.12.
The ``format_number`` filter formats a number:
@@ -97,7 +98,7 @@ By default, the filter uses the current locale. You can pass it explicitly:
.. code-block:: bash
- $ composer req twig/intl-extra
+ $ composer require twig/intl-extra
Then, use the ``twig/extra-bundle`` on Symfony projects or add the extension
explicitly on the Twig environment::
diff --git a/doc/filters/format_time.rst b/doc/filters/format_time.rst
index d542611cb..606078308 100644
--- a/doc/filters/format_time.rst
+++ b/doc/filters/format_time.rst
@@ -2,6 +2,7 @@
===============
.. versionadded:: 2.12
+
The ``format_time`` filter was added in Twig 2.12.
The ``format_time`` filter formats a time. It behaves in the exact same way as
@@ -14,7 +15,7 @@ the :doc:`format_datetime` filter, but without the date.
.. code-block:: bash
- $ composer req twig/intl-extra
+ $ composer require twig/intl-extra
Then, use the ``twig/extra-bundle`` on Symfony projects or add the extension
explicitly on the Twig environment::
diff --git a/doc/filters/html_to_markdown.rst b/doc/filters/html_to_markdown.rst
index 81751c120..d382724e4 100644
--- a/doc/filters/html_to_markdown.rst
+++ b/doc/filters/html_to_markdown.rst
@@ -2,11 +2,12 @@
====================
.. versionadded:: 2.12
+
The ``html_to_markdown`` filter was added in Twig 2.12.
The ``html_to_markdown`` filter converts a block of HTML to Markdown:
-.. code-block:: twig
+.. code-block:: html+twig
{% apply html_to_markdown %}
@@ -27,14 +28,14 @@ You can also use the filter on an entire template which you ``include``:
.. code-block:: bash
- $ composer req twig/markdown-extra
+ $ composer require twig/markdown-extra
On Symfony projects, you can automatically enable it by installing the
``twig/extra-bundle``:
.. code-block:: bash
- $ composer req twig/extra-bundle
+ $ composer require twig/extra-bundle
Or add the extension explicitly on the Twig environment::
@@ -67,7 +68,7 @@ the following compatible libraries, from which you can choose:
Depending on the library, you can also add some options by passing them as an argument
to the filter. Example for ``league/html-to-markdown``:
-.. code-block:: twig
+.. code-block:: html+twig
{% apply html_to_markdown({hard_break: false}) %}
diff --git a/doc/filters/inky_to_html.rst b/doc/filters/inky_to_html.rst
index fe215228f..8a6691650 100644
--- a/doc/filters/inky_to_html.rst
+++ b/doc/filters/inky_to_html.rst
@@ -2,12 +2,13 @@
================
.. versionadded:: 2.12
+
The ``inky_to_html`` filter was added in Twig 2.12.
The ``inky_to_html`` filter processes an `inky email template
`_:
-.. code-block:: twig
+.. code-block:: html+twig
{% apply inky_to_html %}
@@ -29,7 +30,7 @@ You can also use the filter on an included file:
.. code-block:: bash
- $ composer req twig/inky-extra
+ $ composer require twig/inky-extra
Then, use the ``twig/extra-bundle`` on Symfony projects or add the extension
explicitly on the Twig environment::
diff --git a/doc/filters/inline_css.rst b/doc/filters/inline_css.rst
index daff5ac2b..3da6fd95e 100644
--- a/doc/filters/inline_css.rst
+++ b/doc/filters/inline_css.rst
@@ -2,11 +2,12 @@
==============
.. versionadded:: 2.12
+
The ``inline_css`` filter was added in Twig 2.12.
The ``inline_css`` filter inline CSS styles in HTML documents:
-.. code-block:: twig
+.. code-block:: html+twig
{% apply inline_css %}
@@ -23,7 +24,7 @@ The ``inline_css`` filter inline CSS styles in HTML documents:
You can also add some stylesheets by passing them as arguments to the filter:
-.. code-block:: twig
+.. code-block:: html+twig
{% apply inline_css(source("some_styles.css"), source("another.css")) %}
@@ -53,7 +54,7 @@ Note that the CSS inliner works on an entire HTML document, not a fragment.
.. code-block:: bash
- $ composer req twig/cssinliner-extra
+ $ composer require twig/cssinliner-extra
Then, use the ``twig/extra-bundle`` on Symfony projects or add the extension
explicitly on the Twig environment::
diff --git a/doc/filters/join.rst b/doc/filters/join.rst
index a9ea147e4..ed8d01ec4 100644
--- a/doc/filters/join.rst
+++ b/doc/filters/join.rst
@@ -2,6 +2,7 @@
========
.. versionadded:: 2.6.1
+
The ``and`` argument was added in Twig 2.6.1.
The ``join`` filter returns a string which is the concatenation of the items
diff --git a/doc/filters/language_name.rst b/doc/filters/language_name.rst
index 844bce329..5e21a048a 100644
--- a/doc/filters/language_name.rst
+++ b/doc/filters/language_name.rst
@@ -2,6 +2,7 @@
=================
.. versionadded:: 2.12
+
The ``language_name`` filter was added in Twig 2.12.
The ``language_name`` filter returns the language name given its two-letter
@@ -29,7 +30,7 @@ By default, the filter uses the current locale. You can pass it explicitly:
.. code-block:: bash
- $ composer req twig/intl-extra
+ $ composer require twig/intl-extra
Then, use the ``twig/extra-bundle`` on Symfony projects or add the extension
explicitly on the Twig environment::
diff --git a/doc/filters/locale_name.rst b/doc/filters/locale_name.rst
index 222da7367..24c3e130c 100644
--- a/doc/filters/locale_name.rst
+++ b/doc/filters/locale_name.rst
@@ -2,6 +2,7 @@
===============
.. versionadded:: 2.12
+
The ``locale_name`` filter was added in Twig 2.12.
The ``locale_name`` filter returns the locale name given its two-letter
@@ -29,7 +30,7 @@ By default, the filter uses the current locale. You can pass it explicitly:
.. code-block:: bash
- $ composer req twig/intl-extra
+ $ composer require twig/intl-extra
Then, use the ``twig/extra-bundle`` on Symfony projects or add the extension
explicitly on the Twig environment::
diff --git a/doc/filters/markdown_to_html.rst b/doc/filters/markdown_to_html.rst
index 378748938..179d29ec5 100644
--- a/doc/filters/markdown_to_html.rst
+++ b/doc/filters/markdown_to_html.rst
@@ -2,6 +2,7 @@
====================
.. versionadded:: 2.12
+
The ``markdown_to_html`` filter was added in Twig 2.12.
The ``markdown_to_html`` filter converts a block of Markdown to HTML:
@@ -42,7 +43,7 @@ You can also use the filter on an included file or a variable:
.. code-block:: bash
- $ composer req twig/markdown-extra
+ $ composer require twig/markdown-extra
Then, use the ``twig/extra-bundle`` on Symfony projects or add the extension
explicitly on the Twig environment::
diff --git a/doc/filters/sort.rst b/doc/filters/sort.rst
index 1df70ffdb..46ac5c3fc 100644
--- a/doc/filters/sort.rst
+++ b/doc/filters/sort.rst
@@ -2,6 +2,7 @@
========
.. versionadded:: 2.12
+
The ``arrow`` argument was added in Twig 2.12.
The ``sort`` filter sorts an array:
@@ -20,7 +21,7 @@ The ``sort`` filter sorts an array:
You can pass an arrow function to sort the array:
-.. code-block:: twig
+.. code-block:: html+twig
{% set fruits = [
{ name: 'Apples', quantity: 5 },
diff --git a/doc/filters/spaceless.rst b/doc/filters/spaceless.rst
index 007fda4af..0e49515ad 100644
--- a/doc/filters/spaceless.rst
+++ b/doc/filters/spaceless.rst
@@ -1,10 +1,6 @@
``spaceless``
=============
-.. versionadded:: 1.38
-
- The ``spaceless`` filter was added in Twig 1.38.
-
Use the ``spaceless`` filter to remove whitespace *between HTML tags*, not
whitespace within HTML tags or whitespace in plain text:
diff --git a/doc/filters/timezone_name.rst b/doc/filters/timezone_name.rst
index dbb377503..dc64eca5d 100644
--- a/doc/filters/timezone_name.rst
+++ b/doc/filters/timezone_name.rst
@@ -2,6 +2,7 @@
=================
.. versionadded:: 2.12
+
The ``timezone_name`` filter was added in Twig 2.12.
The ``timezone_name`` filter returns the timezone name given a timezone identifier:
@@ -28,7 +29,7 @@ By default, the filter uses the current locale. You can pass it explicitly:
.. code-block:: bash
- $ composer req twig/intl-extra
+ $ composer require twig/intl-extra
Then, use the ``twig/extra-bundle`` on Symfony projects or add the extension
explicitly on the Twig environment::
diff --git a/doc/filters/u.rst b/doc/filters/u.rst
index b97a24447..1adf83c00 100644
--- a/doc/filters/u.rst
+++ b/doc/filters/u.rst
@@ -2,6 +2,7 @@
=====
.. versionadded:: 2.12.1
+
The ``u`` filter was added in Twig 2.12.1.
The ``u`` filter wraps a text in a Unicode object (a `Symfony UnicodeString
@@ -74,7 +75,7 @@ For large strings manipulation, use the ``apply`` tag:
.. code-block:: bash
- $ composer req twig/string-extra
+ $ composer require twig/string-extra
Then, use the ``twig/extra-bundle`` on Symfony projects or add the extension
explicitly on the Twig environment::
diff --git a/doc/functions/country_timezones.rst b/doc/functions/country_timezones.rst
index 860bd6fad..609584332 100644
--- a/doc/functions/country_timezones.rst
+++ b/doc/functions/country_timezones.rst
@@ -2,6 +2,7 @@
=====================
.. versionadded:: 2.12
+
The ``country_timezones`` function was added in Twig 2.12.
The ``country_timezones`` function returns the names of the timezones associated
@@ -19,7 +20,7 @@ with a given country code:
.. code-block:: bash
- $ composer req twig/intl-extra
+ $ composer require twig/intl-extra
Then, use the ``twig/extra-bundle`` on Symfony projects or add the extension
explicitly on the Twig environment::
diff --git a/doc/functions/html_classes.rst b/doc/functions/html_classes.rst
index 778fbe333..cc6b2d9e3 100644
--- a/doc/functions/html_classes.rst
+++ b/doc/functions/html_classes.rst
@@ -2,12 +2,13 @@
================
.. versionadded:: 2.12
+
The ``html_classes`` function was added in Twig 2.12.
The ``html_classes`` function returns a string by conditionally joining class
names together:
-.. code-block:: jinja
+.. code-block:: html+twig
{{ _self.input('password', '', 'password') }}
{% macro input(name, value, type = "text", size = 20) %}
-
+
{% endmacro %}
Auto-import is only available as of Twig 2.11. For older versions, import
@@ -100,10 +100,10 @@ via the ``from`` tag:
Before Twig 2.11, when you want to use a macro in another macro from the
same file, you need to import it locally:
- .. code-block:: twig
+ .. code-block:: html+twig
{% macro input(name, value, type, size) %}
-
+
{% endmacro %}
{% macro wrapped_input(name, value, type, size) %}
diff --git a/doc/templates.rst b/doc/templates.rst
index b5b33e9a7..d5bd9ba65 100644
--- a/doc/templates.rst
+++ b/doc/templates.rst
@@ -787,6 +787,7 @@ Whitespace Control
------------------
.. versionadded:: 2.8
+
Tag level Line whitespace control was added in Twig 2.8.
The first newline after a template tag is removed automatically (like in PHP).