diff --git a/doc/api.rst b/doc/api.rst index 24b1baea7..5f1f02775 100644 --- a/doc/api.rst +++ b/doc/api.rst @@ -35,7 +35,7 @@ templates from a database or other resources. Notice that the second argument of the environment is an array of options. The ``cache`` option is a compilation cache directory, where Twig caches - the compiled templates to avoid the parsing phase for sub-sequent + the compiled templates to avoid the parsing phase for subsequent requests. It is very different from the cache you might want to add for the evaluated templates. For such a need, you can use any available PHP cache library. @@ -196,7 +196,7 @@ methods:: $loader->addPath($templateDir3); $loader->prependPath($templateDir4); -The filesystem loader also supports namespaced templates. This allows to group +The filesystem loader also supports namespaced templates. This allows you to group your templates under different namespaces which have their own template paths. When using the ``setPaths()``, ``addPath()``, and ``prependPath()`` methods, diff --git a/doc/deprecated.rst b/doc/deprecated.rst index 3348c59cb..c29fd4f18 100644 --- a/doc/deprecated.rst +++ b/doc/deprecated.rst @@ -72,7 +72,7 @@ Nodes deprecated. * The ``Twig\Node\Expression\NameExpression::isSimple()`` and - ``Twig\Node\Expression\NameExpression::isSpecial()`` methods are deprecated as + ``Twig\Node\Expression\NameExpression::isSpecial()`` methods are deprecated as of Twig 3.11 and will be removed in Twig 4.0. * The ``filter`` node of ``Twig\Node\Expression\FilterExpression`` is diff --git a/doc/filters/escape.rst b/doc/filters/escape.rst index 6da700794..ed1b7c429 100644 --- a/doc/filters/escape.rst +++ b/doc/filters/escape.rst @@ -39,11 +39,11 @@ And here is how to escape variables included in JavaScript code: The ``escape`` filter supports the following escaping strategies for HTML documents: -* ``html``: escapes a string for the **HTML body** context, +* ``html``: escapes a string for the **HTML body** context, or for HTML attributes values **inside quotes**. -* ``js``: escapes a string for the **JavaScript** context. This is intended for - use in JavaScript or JSON strings, and encodes values using backslash escape +* ``js``: escapes a string for the **JavaScript** context. This is intended for + use in JavaScript or JSON strings, and encodes values using backslash escape sequences. * ``css``: escapes a string for the **CSS** context. CSS escaping can be diff --git a/doc/filters/filter.rst b/doc/filters/filter.rst index 257421f66..3cc542487 100644 --- a/doc/filters/filter.rst +++ b/doc/filters/filter.rst @@ -11,7 +11,7 @@ function. The arrow function receives the value of the sequence or mapping: {{ sizes|filter(v => v > 38)|join(', ') }} {# output 40, 42 #} -Combined with the ``for`` tag, it allows to filter the items to iterate over: +Combined with the ``for`` tag, it allows you to filter the items to iterate over: .. code-block:: twig diff --git a/doc/filters/slug.rst b/doc/filters/slug.rst index f5b91b2da..6f60f50a2 100644 --- a/doc/filters/slug.rst +++ b/doc/filters/slug.rst @@ -2,7 +2,7 @@ ======== The ``slug`` filter transforms a given string into another string that -only includes safe ASCII characters. +only includes safe ASCII characters. Here is an example: @@ -11,8 +11,8 @@ Here is an example: {{ 'Wôrķšƥáçè ~~sèťtïñğš~~'|slug }} Workspace-settings -The default separator between words is a dash (``-``), but you can -define a selector of your choice by passing it as an argument: +The default separator between words is a dash (``-``), but you can +define a separator of your choice by passing it as an argument: .. code-block:: twig @@ -27,8 +27,8 @@ argument: {{ '...'|slug('-', 'ko') }} -The ``slug`` filter uses the method by the same name in Symfony's -`AsciiSlugger `_. +The ``slug`` filter uses the method by the same name in Symfony's +`AsciiSlugger `_. .. note:: diff --git a/doc/functions/country_timezones.rst b/doc/functions/country_timezones.rst index 370a4beff..5b64e89bd 100644 --- a/doc/functions/country_timezones.rst +++ b/doc/functions/country_timezones.rst @@ -2,14 +2,14 @@ ===================== The ``country_timezones`` function returns the names of the timezones associated -with a given country its ISO-3166 code: +with a given country code (ISO-3166): .. code-block:: twig {# Europe/Paris #} {{ country_timezones('FR')|join(', ') }} -If the specified country were to be unknown, it will return an empty array +If the specified country is unknown, it will return an empty array. .. note:: diff --git a/doc/recipes.rst b/doc/recipes.rst index 2864fdab7..dcaa28663 100644 --- a/doc/recipes.rst +++ b/doc/recipes.rst @@ -31,7 +31,7 @@ catches deprecation notices, and return them. template names as keys and template contents as values (as done by ``\Twig\Util\TemplateDirIterator``). -However, this code won't find all deprecations (like using deprecated some Twig +However, this code won't find all deprecations (like using some deprecated Twig classes). To catch all notices, register a custom error handler like the one below:: diff --git a/doc/tags/block.rst b/doc/tags/block.rst index 272bc7f34..8c88d0c31 100644 --- a/doc/tags/block.rst +++ b/doc/tags/block.rst @@ -5,7 +5,7 @@ Blocks are used for inheritance and act as placeholders and replacements at the same time. They are documented in detail in the documentation for the :doc:`extends<../tags/extends>` tag. -Block names must consist of alphanumeric characters, and underscores. The first char can't be a digit and dashes are not permitted. +Block names must consist of alphanumeric characters, and underscores. The first character can't be a digit and dashes are not permitted. .. seealso:: diff --git a/doc/tags/cache.rst b/doc/tags/cache.rst index b1d032bc4..5a02145fc 100644 --- a/doc/tags/cache.rst +++ b/doc/tags/cache.rst @@ -42,7 +42,7 @@ version of the template code, ``post.id`` represent the id of the blog post, and ``post.updated_at`` returns a timestamp that represents the time where the blog post was last modified. -Using such a strategy for naming cache keys allows to avoid using a ``ttl``. +Using such a strategy for naming cache keys allows you to avoid using a ``ttl``. It's like using a "validation" strategy instead of an "expiration" strategy as we do for HTTP caches. diff --git a/doc/templates.rst b/doc/templates.rst index d82557a2c..af0a59b33 100644 --- a/doc/templates.rst +++ b/doc/templates.rst @@ -342,7 +342,7 @@ Inline comments can also be on the same line as the expression: }} As inline comments continue until the end of the current line, the following -code does not work as ``}}``would be part of the comment: +code does not work as ``}}`` would be part of the comment: .. code-block:: twig @@ -591,7 +591,7 @@ exist: * ``42`` / ``42.23``: Integers and floating point numbers are created by writing the number down. If a dot is present the number is a float, - otherwise an integer. Underscores can be used as digits separator to + otherwise an integer. Underscores can be used as digits separator to improve readability (``-3_141.592_65`` is equivalent to ``-3141.59265``). * ``["first_name", "last_name"]``: Sequences are defined by a sequence of expressions @@ -933,7 +933,7 @@ The following operators don't fit into any of the other categories: To resolve ``user.name`` to a PHP call, Twig uses the following algorithm at runtime: - * check if ``user`` is a PHP array or a ArrayObject/ArrayAccess object and + * check if ``user`` is a PHP array or an ArrayObject/ArrayAccess object and ``name`` a valid element; * if not, and if ``user`` is a PHP object, check that ``name`` is a valid property; * if not, and if ``user`` is a PHP object, check that ``name`` is a class constant; @@ -959,7 +959,7 @@ The following operators don't fit into any of the other categories: Twig supports a specific syntax via the ``()`` operator for calling methods on objects, like in ``user.name()``: - * check if ``user`` is a object and has the ``name()``, ``getName()``, + * check if ``user`` is an object and has the ``name()``, ``getName()``, ``isName()``, or ``hasName()`` method; * if not, and if ``strict_variables`` is ``false``, return ``null``; * if not, throw an exception.