Compare commits

...

7 Commits

Author SHA1 Message Date
Taneli Hukkinen e355862391
Clarify that CR not followed by LF is not allowed in an MLB (#867) 2022-01-16 06:26:05 +00:00
Pradyun Gedam 6de8059654
Merge pull request #859 from eksortso/i846_dot_def_tables 2021-12-13 08:59:04 +00:00
Dave Ostroske 1b0b884462
Update toml.md
Co-authored-by: Thomas Pelletier <github@pelletier.codes>
2021-11-25 22:25:59 -05:00
Dave Ostroske 3085d25869 Merge branch 'master' into i846_dot_def_tables 2021-11-18 04:56:48 -05:00
Pradyun Gedam 8296d6ba97
Merge pull request #849 from arp242/quoted-key 2021-09-26 09:38:05 +01:00
Martin Tournoij 087eaac3a2 Clarify that multi-line strings are not allowed in key names
There have been two cases recently where I had someone who was confused
about this.

This clarifies that multi-line strings are not allowed as key names for
the casual reader; the phrases "basic string" and "literal string" have
a specific meaning in the TOML spec, but that's not really obvious if
you're just looking up "what is the valid syntax for a key?" as the
rules are explained in a different section, and it requires some careful
reading.
2021-09-23 16:16:57 +08:00
Dave Ostroske 7f19cf4830 Clarify where and how dotted keys define tables 2021-09-05 23:20:28 -04:00
2 changed files with 11 additions and 8 deletions

View File

@ -2,7 +2,7 @@
## unreleased
Nothing.
* Clarify where and how dotted keys define tables.
## 1.0.0 / 2021-01-11

17
toml.md
View File

@ -128,12 +128,13 @@ to use bare keys except when absolutely necessary.
```
A bare key must be non-empty, but an empty quoted key is allowed (though
discouraged).
discouraged). You cannot use multi-line strings to define quoted keys.
```toml
= "no key name" # INVALID
"" = "blank" # VALID but discouraged
'' = 'blank' # VALID but discouraged
= "no key name" # INVALID
"""key""" = "not allowed" # INVALID
"" = "blank" # VALID but discouraged
'' = 'blank' # VALID but discouraged
```
**Dotted keys** are a sequence of bare or quoted keys joined with a dot. This
@ -341,7 +342,8 @@ str3 = """\
Any Unicode character may be used except those that must be escaped: backslash
and the control characters other than tab, line feed, and carriage return
(U+0000 to U+0008, U+000B, U+000C, U+000E to U+001F, U+007F).
(U+0000 to U+0008, U+000B, U+000C, U+000E to U+001F, U+007F). Carriage returns
(U+000D) are only allowed as part of a newline sequence.
You can write a quotation mark, or two adjacent quotation marks, anywhere inside
a multi-line basic string. They can also be written just inside the delimiters.
@ -759,8 +761,9 @@ name = "Regina Dogman"
member_since = 1999-08-04
```
Dotted keys create and define a table for each key part before the last one,
provided that such tables were not previously created.
Dotted keys create and define a table for each key part before the last one. Any
such table must have all its key/value pairs defined under the current `[table]`
header, or in the root table if defined before all headers, or in one inline table.
```toml
fruit.apple.color = "red"