mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-06 15:37:58 +00:00
Fix: DOCtor-RST build
This commit is contained in:
@@ -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.<br />'
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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::
|
||||
|
||||
@@ -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::
|
||||
|
||||
@@ -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::
|
||||
|
||||
@@ -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::
|
||||
|
||||
@@ -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::
|
||||
|
||||
@@ -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<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::
|
||||
|
||||
@@ -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::
|
||||
|
||||
@@ -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::
|
||||
|
||||
@@ -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<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::
|
||||
|
||||
@@ -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 %}
|
||||
<html>
|
||||
@@ -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}) %}
|
||||
<html>
|
||||
|
||||
@@ -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
|
||||
<https://github.com/zurb/inky>`_:
|
||||
|
||||
.. code-block:: twig
|
||||
.. code-block:: html+twig
|
||||
|
||||
{% apply inky_to_html %}
|
||||
<row>
|
||||
@@ -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::
|
||||
|
||||
@@ -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 %}
|
||||
<html>
|
||||
@@ -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")) %}
|
||||
<html>
|
||||
@@ -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::
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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::
|
||||
|
||||
@@ -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::
|
||||
|
||||
@@ -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::
|
||||
|
||||
@@ -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 },
|
||||
|
||||
@@ -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:
|
||||
|
||||
|
||||
@@ -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::
|
||||
|
||||
+2
-1
@@ -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::
|
||||
|
||||
@@ -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::
|
||||
|
||||
@@ -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
|
||||
|
||||
<p class="{{ html_classes('a-class', 'another-class', {
|
||||
'errored': object.errored,
|
||||
@@ -22,7 +23,7 @@ names together:
|
||||
|
||||
.. 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::
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
==========
|
||||
|
||||
.. versionadded:: 2.7
|
||||
|
||||
The "max" argument was added in Twig 2.7.
|
||||
|
||||
The ``random`` function returns a random value depending on the supplied
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
========================
|
||||
|
||||
.. versionadded:: 2.8
|
||||
|
||||
The name argument was added in Twig 2.8.
|
||||
|
||||
The ``template_from_string`` function loads a template from a string:
|
||||
|
||||
+1
-1
@@ -35,7 +35,7 @@ The recommended way to install Twig is via Composer:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
composer require "twig/twig:^2.0"
|
||||
composer requireuire "twig/twig:^2.0"
|
||||
|
||||
Basic API Usage
|
||||
---------------
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
=========
|
||||
|
||||
.. versionadded:: 2.9
|
||||
|
||||
The ``apply`` tag was added in Twig 2.9.
|
||||
|
||||
The ``apply`` tag allows you to apply Twig filters on a block of template data:
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
==============
|
||||
|
||||
.. versionadded:: 2.6
|
||||
|
||||
The ``deprecated`` tag was added in Twig 2.6.
|
||||
|
||||
Twig generates a deprecation notice (via a call to the ``trigger_error()``
|
||||
|
||||
+4
-4
@@ -78,12 +78,12 @@ via the ``from`` tag:
|
||||
import the macros as they are automatically available under the special
|
||||
``_self`` variable:
|
||||
|
||||
.. code-block:: twig
|
||||
.. code-block:: html+twig
|
||||
|
||||
<p>{{ _self.input('password', '', 'password') }}</p>
|
||||
|
||||
{% macro input(name, value, type = "text", size = 20) %}
|
||||
<input type="{{ type }}" name="{{ name }}" value="{{ value|e }}" size="{{ size }}" />
|
||||
<input type="{{ type }}" name="{{ name }}" value="{{ value|e }}" size="{{ size }}"/>
|
||||
{% 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) %}
|
||||
<input type="{{ type|default('text') }}" name="{{ name }}" value="{{ value|e }}" size="{{ size|default(20) }}" />
|
||||
<input type="{{ type|default('text') }}" name="{{ name }}" value="{{ value|e }}" size="{{ size|default(20) }}"/>
|
||||
{% endmacro %}
|
||||
|
||||
{% macro wrapped_input(name, value, type, size) %}
|
||||
|
||||
@@ -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).
|
||||
|
||||
Reference in New Issue
Block a user