mirror of
https://github.com/fmtlib/fmt.git
synced 2025-01-10 00:36:38 +00:00
Update syntax.rst
This commit is contained in:
parent
3b5f3de3b5
commit
f5ec5ada2b
@ -491,7 +491,7 @@ Range Format Specifications
|
|||||||
Format specifications for range types have the following syntax:
|
Format specifications for range types have the following syntax:
|
||||||
|
|
||||||
.. productionlist:: sf
|
.. productionlist:: sf
|
||||||
range_format_spec: [":" ["n"][`range_type`][`range_underlying_spec`]]
|
range_format_spec: ["n"][`range_type`][`range_underlying_spec`]
|
||||||
|
|
||||||
The ``'n'`` option formats the range without the opening and closing brackets.
|
The ``'n'`` option formats the range without the opening and closing brackets.
|
||||||
|
|
||||||
@ -500,23 +500,24 @@ The available presentation types for `range_type` are:
|
|||||||
+---------+----------------------------------------------------------+
|
+---------+----------------------------------------------------------+
|
||||||
| Type | Meaning |
|
| Type | Meaning |
|
||||||
+=========+==========================================================+
|
+=========+==========================================================+
|
||||||
|
| none | Default format. |
|
||||||
|
+---------+----------------------------------------------------------+
|
||||||
| ``'s'`` | String format. The range is formatted as a string. |
|
| ``'s'`` | String format. The range is formatted as a string. |
|
||||||
+---------+----------------------------------------------------------+
|
+---------+----------------------------------------------------------+
|
||||||
| ``'?s'``| Debug format. The range is formatted as an escaped |
|
| ``'?s'``| Debug format. The range is formatted as an escaped |
|
||||||
| | string. |
|
| | string. |
|
||||||
+---------+----------------------------------------------------------+
|
+---------+----------------------------------------------------------+
|
||||||
| none | Default format. The range is formatted with a separator. |
|
|
||||||
+---------+----------------------------------------------------------+
|
|
||||||
|
|
||||||
If `range_type` is ``'s'`` or ``'?s'``, the range element type must be a character type. The
|
If `range_type` is ``'s'`` or ``'?s'``, the range element type must be a
|
||||||
``'n'`` option and `range_underlying_spec` are mutually exclusive with ``'s'`` and ``'?s'``.
|
character type. The ``'n'`` option and `range_underlying_spec` are mutually
|
||||||
|
exclusive with ``'s'`` and ``'?s'``.
|
||||||
|
|
||||||
The `range_underlying_spec` is parsed based on the formatter of the range's
|
The `range_underlying_spec` is parsed based on the formatter of the range's
|
||||||
reference type.
|
element type.
|
||||||
|
|
||||||
By default, a range of characters or strings is printed escaped and quoted. But
|
By default, a range of characters or strings is printed escaped and quoted.
|
||||||
if any `range_underlying_spec` is provided (even if it is empty), then the characters
|
But if any `range_underlying_spec` is provided (even if it is empty), then
|
||||||
or strings are printed according to the provided specification.
|
the characters or strings are printed according to the provided specification.
|
||||||
|
|
||||||
Examples::
|
Examples::
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user