mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-11 09:56:32 +00:00
minor #4737 Update u.rst to clarify truncate method's third argument behavior (Always-Victorious)
This PR was merged into the 3.x branch.
Discussion
----------
Update u.rst to clarify truncate method's third argument behavior
Current wording "to preserve whole words" suggests setting the argument to ``true`` preserves words. However, the parameter is ``$cut`` (defaults to ``true`` for cutting at exact length), and ``false`` is required to preserve whole words.
Commits
-------
28c2606be7 Update u.rst to clarify truncate method's third argument behavior
This commit is contained in:
+1
-1
@@ -31,7 +31,7 @@ Truncating a string:
|
||||
{{ 'Lorem ipsum'|u.truncate(8, '...') }}
|
||||
Lorem...
|
||||
|
||||
The ``truncate`` method also accepts a third argument to preserve whole words:
|
||||
By default, ``truncate`` cuts text at the exact length. Pass ``false`` as the third argument to preserve whole words:
|
||||
|
||||
.. code-block:: twig
|
||||
|
||||
|
||||
Reference in New Issue
Block a user