From 3d6869065b6d4e4e5b5de9c729b79b3d2eec6e93 Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Wed, 29 May 2024 18:32:33 -0700 Subject: [PATCH] Improve syntax markdown --- doc/syntax.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/doc/syntax.md b/doc/syntax.md index 0b86c178..79fb3e36 100644 --- a/doc/syntax.md +++ b/doc/syntax.md @@ -1,6 +1,6 @@ # Format String Syntax {#syntax} -[Formatting functions](api) such as `fmt::format` and `fmt::print` use the same +[Formatting functions](api.md) such as `fmt::format` and `fmt::print` use the same format string syntax described in this section. Format strings contain "replacement fields" surrounded by curly braces `{}`. @@ -11,15 +11,15 @@ literal text, it can be escaped by doubling: `{{` and `}}`. The grammar for a replacement field is as follows: - -replacement_field ::= "{" [arg_id] [":" ([format_spec](#format-spec) | [chrono_format_spec](#chrono-format-spec))] "}" +
+replacement_field ::= "{" [arg_id] [":" (format_spec | chrono_format_spec)] "}"
 arg_id            ::= integer | identifier
 integer           ::= digit+
 digit             ::= "0"..."9"
 identifier        ::= id_start id_continue*
 id_start          ::= "a"..."z" | "A"..."Z" | "_"
 id_continue       ::= id_start | digit
-
+
In less formal terms, the replacement field can start with an *arg_id* that specifies the argument whose value is to be formatted and inserted into the @@ -70,7 +70,7 @@ The general form of a *standard format specifier* is: -format_spec ::= [[fill]align][sign]["#"]["0"][width]["." precision]["L"][type] +format_spec ::= [[fill]align]\[sign]["#"]\["0"][width]["." precision]["L"]\[type] fill ::= align ::= "<" | ">" | "^" sign ::= "+" | "-" | " " @@ -330,7 +330,7 @@ month) are valid only for `std::tm` and time points but not durations. Format specifications for range types have the following syntax: -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