Fix markdown

This commit is contained in:
Victor Zverovich 2024-05-30 20:26:19 -07:00
parent e80f4a9b72
commit 191b0cb486

View File

@ -12,7 +12,8 @@ The grammar for a replacement field is as follows:
<a id="replacement-field"></a>
<pre>
replacement_field ::= "{" [arg_id] [":" (<a href="#format-spec">format_spec</a> | <a href="#chrono-format-spec">chrono_format_spec</a>)] "}"
replacement_field ::= "{" [arg_id] [":" (<a href="#format-spec">format_spec</a
> | <a href="#chrono-format-spec">chrono_format_spec</a>)] "}"
arg_id ::= integer | identifier
integer ::= digit+
digit ::= "0"..."9"
@ -77,8 +78,10 @@ format_spec ::= [[fill]align][sign]["#"]["0"][width]["." precision]["L"][type]
fill ::= &lt;a character other than '{' or '}'>
align ::= "<" | ">" | "^"
sign ::= "+" | "-" | " "
width ::= <a href="#replacement-field">integer</a> | "{" [<a href="#replacement-field">arg_id</a>] "}"
precision ::= <a href="#replacement-field">integer</a> | "{" [<a href="#replacement-field">arg_id</a>] "}"
width ::= <a href="#replacement-field">integer</a> | "{" [<a
href="#replacement-field">arg_id</a>] "}"
precision ::= <a href="#replacement-field">integer</a> | "{" [<a
href="#replacement-field">arg_id</a>] "}"
type ::= "a" | "A" | "b" | "B" | "c" | "d" | "e" | "E" | "f" | "F" |
"g" | "G" | "o" | "p" | "s" | "x" | "X" | "?"
</pre>
@ -92,13 +95,10 @@ the fill character and the alignment option are absent.
The meaning of the various alignment options is as follows:
<table>
<thead>
<tr>
<th>Option</th>
<th>Meaning</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>'<'</code></td>
<td>
@ -117,7 +117,6 @@ The meaning of the various alignment options is as follows:
<td><code>'^'</code></td>
<td>Forces the field to be centered within the available space.</td>
</tr>
</tbody>
</table>
Note that unless a minimum field width is defined, the field width will
@ -127,11 +126,29 @@ option has no meaning in this case.
The *sign* option is only valid for floating point and signed integer
types, and can be one of the following:
| Option | Meaning |
|--------|-------------------------------------------------------------------------------------------------------------|
| `'+'` | indicates that a sign should be used for both nonnegative as well as negative numbers. |
| `'-'` | indicates that a sign should be used only for negative numbers (this is the default behavior). |
| space | indicates that a leading space should be used on nonnegative numbers, and a minus sign on negative numbers. |
<table>
<tr>
<th>Option</th>
<th>Meaning</th>
</tr>
<tr>
<td><code>'+'</code></td>
<td>
Indicates that a sign should be used for both nonnegative as well as
negative numbers.
</td>
<td><code>'-'</code></td>
<td>
Indicates that a sign should be used only for negative numbers (this is the
default behavior).
</td>
<td>space</td>
<td>
Indicates that a leading space should be used on nonnegative numbers, and a
minus sign on negative numbers.
</td>
</tr>
</table>
The `'#'` option causes the "alternate form" to be used for the
conversion. The alternate form is defined differently for different
@ -191,16 +208,58 @@ The available character presentation types are:
The available integer presentation types are:
| Type | Meaning |
|-------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `'b'` | Binary format. Outputs the number in base 2. Using the `'#'` option with this type adds the prefix `"0b"` to the output value. |
| `'B'` | Binary format. Outputs the number in base 2. Using the `'#'` option with this type adds the prefix `"0B"` to the output value. |
| `'c'` | Character format. Outputs the number as a character. |
| `'d'` | Decimal integer. Outputs the number in base 10. |
| `'o'` | Octal format. Outputs the number in base 8. |
| `'x'` | Hex format. Outputs the number in base 16, using lower-case letters for the digits above 9. Using the `'#'` option with this type adds the prefix `"0x"` to the output value. |
| `'X'` | Hex format. Outputs the number in base 16, using upper-case letters for the digits above 9. Using the `'#'` option with this type adds the prefix `"0X"` to the output value. |
| none | The same as `'d'`. |
<table>
<tr>
<th>Type</th>
<th>Meaning</th>
</tr>
<tr>
<td><code>'b'</code></td>
<td>
Binary format. Outputs the number in base 2. Using the <code>'#'</code>
option with this type adds the prefix <code>"0b"</code> to the output value.
</td>
</tr>
<tr>
<td><code>'B'</code></td>
<td>
Binary format. Outputs the number in base 2. Using the <code>'#'</code>
option with this type adds the prefix <code>"0B"</code> to the output value.
</td>
</tr>
<tr>
<td><code>'c'</code></td>
<td>Character format. Outputs the number as a character.</td>
</tr>
<tr>
<td><code>'d'</code></td>
<td>Decimal integer. Outputs the number in base 10.</td>
</tr>
<tr>
<td><code>'o'</code></td>
<td>Octal format. Outputs the number in base 8.</td>
</tr>
<tr>
<td><code>'x'</code></td>
<td>
Hex format. Outputs the number in base 16, using lower-case letters for the
digits above 9. Using the <code>'#'</code> option with this type adds the
prefix <code>"0x"</code> to the output value.
</td>
</tr>
<tr>
<td><code>'X'</code></td>
<td>
Hex format. Outputs the number in base 16, using upper-case letters for the
digits above 9. Using the <code>'#'</code> option with this type adds the
prefix <code>"0X"</code> to the output value.
</td>
</tr>
<tr>
<td>none</td>
<td>The same as <code>'d'</code>.</td>
</tr>
</table>
Integer presentation types can also be used with character and Boolean values
with the only exception that `'c'` cannot be used with `bool`. Boolean values
@ -209,69 +268,77 @@ presentation type is not specified.
The available presentation types for floating-point values are:
<table style="width:96%;">
<colgroup>
<col style="width: 13%" />
<col style="width: 81%" />
</colgroup>
<thead>
<tr class="header">
<th>Type</th>
<th>Meaning</th>
<table>
<tr>
<th>Type</th>
<th>Meaning</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><code>'a'</code></td>
<td>Hexadecimal floating point format. Prints the number in base 16 with
prefix <code>"0x"</code> and lower-case letters for digits above 9. Uses
<code>'p'</code> to indicate the exponent.</td>
<tr>
<td><code>'a'</code></td>
<td>
Hexadecimal floating point format. Prints the number in base 16 with
prefix <code>"0x"</code> and lower-case letters for digits above 9.
Uses <code>'p'</code> to indicate the exponent.
</td>
</tr>
<tr class="even">
<td><code>'A'</code></td>
<td>Same as <code>'a'</code> except it uses upper-case letters for the
prefix, digits above 9 and to indicate the exponent.</td>
<tr>
<td><code>'A'</code></td>
<td>
Same as <code>'a'</code> except it uses upper-case letters for the
prefix, digits above 9 and to indicate the exponent.
</td>
</tr>
<tr class="odd">
<td><code>'e'</code></td>
<td>Exponent notation. Prints the number in scientific notation using
the letter 'e' to indicate the exponent.</td>
<tr>
<td><code>'e'</code></td>
<td>
Exponent notation. Prints the number in scientific notation using
the letter 'e' to indicate the exponent.
</td>
</tr>
<tr class="even">
<td><code>'E'</code></td>
<td>Exponent notation. Same as <code>'e'</code> except it uses an
upper-case <code>'E'</code> as the separator character.</td>
<tr>
<td><code>'E'</code></td>
<td>
Exponent notation. Same as <code>'e'</code> except it uses an
upper-case <code>'E'</code> as the separator character.
</td>
</tr>
<tr class="odd">
<td><code>'f'</code></td>
<td>Fixed point. Displays the number as a fixed-point number.</td>
<tr>
<td><code>'f'</code></td>
<td>Fixed point. Displays the number as a fixed-point number.</td>
</tr>
<tr class="even">
<td><code>'F'</code></td>
<td>Fixed point. Same as <code>'f'</code>, but converts <code>nan</code>
to <code>NAN</code> and <code>inf</code> to <code>INF</code>.</td>
<tr>
<td><code>'F'</code></td>
<td>
Fixed point. Same as <code>'f'</code>, but converts <code>nan</code>
to <code>NAN</code> and <code>inf</code> to <code>INF</code>.
</td>
</tr>
<tr class="odd">
<td><code>'g'</code></td>
<td><p>General format. For a given precision <code>p &gt;= 1</code>,
this rounds the number to <code>p</code> significant digits and then
formats the result in either fixed-point format or in scientific
notation, depending on its magnitude.</p>
<p>A precision of <code>0</code> is treated as equivalent to a precision
of <code>1</code>.</p></td>
<tr>
<td><code>'g'</code></td>
<td>
<p>General format. For a given precision <code>p &gt;= 1</code>,
this rounds the number to <code>p</code> significant digits and then
formats the result in either fixed-point format or in scientific
notation, depending on its magnitude.</p>
<p>A precision of <code>0</code> is treated as equivalent to a precision
of <code>1</code>.</p>
</td>
</tr>
<tr class="even">
<td><code>'G'</code></td>
<td>General format. Same as <code>'g'</code> except switches to
<code>'E'</code> if the number gets too large. The representations of
infinity and NaN are uppercased, too.</td>
<tr>
<td><code>'G'</code></td>
<td>
General format. Same as <code>'g'</code> except switches to
<code>'E'</code> if the number gets too large. The representations of
infinity and NaN are uppercased, too.
</td>
</tr>
<tr class="odd">
<td>none</td>
<td>Similar to <code>'g'</code>, except that the default precision is as
high as needed to represent the particular value.</td>
<tr>
<td>none</td>
<td>
Similar to <code>'g'</code>, except that the default precision is as
high as needed to represent the particular value.
</td>
</tr>
</tbody>
</table>
The available presentation types for pointers are:
@ -288,7 +355,9 @@ as `std::tm` have the following syntax:
<a id="chrono-format-spec"></a>
<pre>
chrono_format_spec ::= [[<a href="#format-spec">fill</a>]<a href="#format-spec">align</a>][<a href="#format-spec">width</a>]["." <a href="#format-spec">precision</a>][chrono_specs]
chrono_format_spec ::= [[<a href="#format-spec">fill</a>]<a href="#format-spec"
>align</a>][<a href="#format-spec">width</a>]["." <a href="#format-spec"
>precision</a>][chrono_specs]
chrono_specs ::= [chrono_specs] conversion_spec | chrono_specs literal_char
conversion_spec ::= "%" [padding_modifier] [locale_modifier] chrono_type
literal_char ::= &lt;a character other than '{', '}' or '%'>
@ -359,8 +428,8 @@ The available padding modifiers (*padding_modifier*) are:
| `'_'` | Do not pad a numeric result string. |
| `'0'` | Pad a numeric result string with zeros. |
Currently, these modifiers are only supported for the ``'H', 'I', 'M', 'S', 'U', 'V'``
and ``'W'`` presentation types.
Currently, these modifiers are only supported for the `'H'`, `'I'`, `'M'`,
`'S'`, `'U'`, `'V'` and `'W'` presentation types.
## Range Format Specifications