Skip to content

Commit 77a6da9

Browse files
committed
minor #4616 [Docs] Replace = by : in code examples (smnandre)
This PR was merged into the 3.x branch. Discussion ---------- [Docs] Replace `=` by `:` in code examples Replace `=` by `:` in code examples * function/include * filters/format_number Commits ------- 84b0499 [Docs] Replace `=` by `:` in code examples
2 parents 2a17b4f + 84b0499 commit 77a6da9

File tree

2 files changed

+19
-19
lines changed

2 files changed

+19
-19
lines changed

Diff for: doc/filters/format_number.rst

+17-17
Original file line numberDiff line numberDiff line change
@@ -22,37 +22,37 @@ The list of supported options:
2222
* ``grouping_used``: Specifies whether to use grouping separator for thousands::
2323

2424
{# 1,234,567.89 #}
25-
{{ 1234567.89|format_number({grouping_used:true}, locale='en') }}
25+
{{ 1234567.89|format_number({grouping_used:true}, locale: 'en') }}
2626

2727
* ``decimal_always_shown``: Specifies whether to always show the decimal part, even if it's zero::
2828

2929
{# 123. #}
30-
{{ 123|format_number({decimal_always_shown:true}, locale='en') }}
30+
{{ 123|format_number({decimal_always_shown:true}, locale: 'en') }}
3131

3232
* ``max_integer_digit``:
3333
* ``min_integer_digit``:
3434
* ``integer_digit``: Define constraints on the integer part::
3535

3636
{# 345.679 #}
37-
{{ 12345.6789|format_number({max_integer_digit:3, min_integer_digit:2}, locale='en') }}
37+
{{ 12345.6789|format_number({max_integer_digit:3, min_integer_digit:2}, locale: 'en') }}
3838

3939
* ``max_fraction_digit``:
4040
* ``min_fraction_digit``:
4141
* ``fraction_digit``: Define constraints on the fraction part::
4242

4343
{# 123.46 #}
44-
{{ 123.456789|format_number({max_fraction_digit:2, min_fraction_digit:1}, locale='en') }}
44+
{{ 123.456789|format_number({max_fraction_digit:2, min_fraction_digit:1}, locale: 'en') }}
4545

4646
* ``multiplier``: Multiplies the value before formatting::
4747

4848
{# 123,000 #}
49-
{{ 123|format_number({multiplier:1000}, locale='en') }}
49+
{{ 123|format_number({multiplier:1000}, locale: 'en') }}
5050

5151
* ``grouping_size``:
5252
* ``secondary_grouping_size``: Set the size of the primary and secondary grouping separators::
5353

5454
{# 1,23,45,678 #}
55-
{{ 12345678|format_number({grouping_size:3, secondary_grouping_size:2}, locale='en') }}
55+
{{ 12345678|format_number({grouping_size:3, secondary_grouping_size:2}, locale: 'en') }}
5656

5757
* ``rounding_mode``:
5858
* ``rounding_increment``: Control rounding behavior, here is a list of all rounding_mode available:
@@ -67,7 +67,7 @@ The list of supported options:
6767
.. code-block:: twig
6868
6969
{# 123.5 #}
70-
{{ 123.456|format_number({rounding_mode:'ceiling', rounding_increment:0.05}, locale='en') }}
70+
{{ 123.456|format_number({rounding_mode:'ceiling', rounding_increment:0.05}, locale: 'en') }}
7171
7272
* ``format_width``:
7373
* ``padding_position``: Set width and padding for the formatted number, here is a list of all padding_position available:
@@ -79,19 +79,19 @@ The list of supported options:
7979
.. code-block:: twig
8080
8181
{# 123 #}
82-
{{ 123|format_number({format_width:10, padding_position:'before_suffix'}, locale='en') }}
82+
{{ 123|format_number({format_width:10, padding_position:'before_suffix'}, locale: 'en') }}
8383
8484
* ``significant_digits_used``:
8585
* ``min_significant_digits_used``:
8686
* ``max_significant_digits_used``: Control significant digits in formatting::
8787

8888
{# 123.4568 #}
89-
{{ 123.456789|format_number({significant_digits_used:true, min_significant_digits_used:4, max_significant_digits_used:7}, locale='en') }}
89+
{{ 123.456789|format_number({significant_digits_used:true, min_significant_digits_used:4, max_significant_digits_used:7}, locale: 'en') }}
9090

9191
* ``lenient_parse``: If true, allows lenient parsing of the input::
9292

9393
{# 123 #}
94-
{{ 123|format_number({lenient_parse:true}, locale='en') }}
94+
{{ 123|format_number({lenient_parse:true}, locale: 'en') }}
9595

9696
Besides plain numbers, the filter can also format numbers in various styles::
9797

@@ -109,37 +109,37 @@ The list of supported styles:
109109
* ``decimal``::
110110

111111
{# 1,234.568 #}
112-
{{ 1234.56789 | format_number(style='decimal', locale='en') }}
112+
{{ 1234.56789 | format_number(style: 'decimal', locale: 'en') }}
113113

114114
* ``currency``::
115115

116116
{# $1,234.56 #}
117-
{{ 1234.56 | format_number(style='currency', locale='en') }}
117+
{{ 1234.56 | format_number(style: 'currency', locale: 'en') }}
118118

119119
* ``percent``::
120120

121121
{# 12% #}
122-
{{ 0.1234 | format_number(style='percent', locale='en') }}
122+
{{ 0.1234 | format_number(style: 'percent', locale: 'en') }}
123123

124124
* ``scientific``::
125125

126126
{# 1.23456789e+3 #}
127-
{{ 1234.56789 | format_number(style='scientific', locale='en') }}
127+
{{ 1234.56789 | format_number(style: 'scientific', locale: 'en') }}
128128

129129
* ``spellout``::
130130

131131
{# one thousand two hundred thirty-four point five six seven eight nine #}
132-
{{ 1234.56789 | format_number(style='spellout', locale='en') }}
132+
{{ 1234.56789 | format_number(style: 'spellout', locale: 'en') }}
133133

134134
* ``ordinal``::
135135

136136
{# 1st #}
137-
{{ 1 | format_number(style='ordinal', locale='en') }}
137+
{{ 1 | format_number(style: 'ordinal', locale: 'en') }}
138138

139139
* ``duration``::
140140

141141
{# 2:30:00 #}
142-
{{ 9000 | format_number(style='duration', locale='en') }}
142+
{{ 9000 | format_number(style: 'duration', locale: 'en') }}
143143

144144
As a shortcut, you can use the ``format_*_number`` filters by replacing ``*``
145145
with a style::

Diff for: doc/functions/include.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ You can disable access to the context by setting ``with_context`` to
2727
.. code-block:: twig
2828
2929
{# only the name variable will be accessible #}
30-
{{ include('template.html.twig', {name: 'Fabien'}, with_context = false) }}
30+
{{ include('template.html.twig', {name: 'Fabien'}, with_context: false) }}
3131
3232
.. code-block:: twig
3333
3434
{# no variables will be accessible #}
35-
{{ include('template.html.twig', with_context = false) }}
35+
{{ include('template.html.twig', with_context: false) }}
3636
3737
And if the expression evaluates to a ``\Twig\Template`` or a
3838
``\Twig\TemplateWrapper`` instance, Twig will use it directly::

0 commit comments

Comments
 (0)