mirror of
https://github.com/twigphp/Twig.git
synced 2026-08-17 08:50:50 +00:00
Fix grammar and spelling mistakes in documentation
This commit is contained in:
+2
-2
@@ -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,
|
||||
|
||||
+1
-1
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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 <https://symfony.com/doc/current/components/string.html#slugger>`_.
|
||||
The ``slug`` filter uses the method by the same name in Symfony's
|
||||
`AsciiSlugger <https://symfony.com/doc/current/components/string.html#slugger>`_.
|
||||
|
||||
.. note::
|
||||
|
||||
|
||||
@@ -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::
|
||||
|
||||
|
||||
+1
-1
@@ -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::
|
||||
|
||||
|
||||
+1
-1
@@ -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::
|
||||
|
||||
|
||||
+1
-1
@@ -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.
|
||||
|
||||
|
||||
+4
-4
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user