reworded docs

This commit is contained in:
Fabien Potencier
2017-05-22 07:52:05 +02:00
parent 4e019d4854
commit eb58c61536
+3 -5
View File
@@ -17,15 +17,15 @@ separator using the additional arguments:
.. code-block:: jinja
{{ 9800.333|number_format(2, '.', ',') }}
If you want to format negative numbers, you will need to wrap the number with parantheses. This is due to the `precedence of operators`_ inside Twig
To format negative numbers, wrap the number with parentheses (needed because of
Twig's :ref:`precedence of operators <twig-expressions>`:
.. code-block:: jinja
{{ -9800.333|number_format(2, '.', ',') }} {# outputs : -9 #}
{{ (-9800.333)|number_format(2, '.', ',') }} {# outputs : -9.800,33 #}
If no formatting options are provided then Twig will use the default formatting
options of:
@@ -54,5 +54,3 @@ Arguments
* ``thousand_sep``: The character(s) to use for the thousands separator
.. _`number_format`: http://php.net/number_format
.. _`precedence of operators`: https://twig.sensiolabs.org/doc/2.x/templates.html#expressions