Skip to content

Commit

Permalink
Update example and wording
Browse files Browse the repository at this point in the history
  • Loading branch information
arp242 committed May 21, 2022
1 parent 8967065 commit d61fd93
Showing 1 changed file with 23 additions and 6 deletions.
29 changes: 23 additions & 6 deletions toml.md
Original file line number Diff line number Diff line change
Expand Up @@ -797,7 +797,9 @@ Inline Table
------------

Inline tables provide a more compact syntax for expressing tables. They are
especially useful for grouped data that can otherwise quickly become verbose.
especially useful for grouped data that can otherwise quickly become verbose or
(deeply) nested data.

Inline tables are defined within curly braces: `{` and `}`. Within the braces,
zero or more comma-separated key/value pairs may appear. Key/value pairs take
the same form as key/value pairs in standard tables. All value types are
Expand All @@ -808,12 +810,19 @@ put on different lines. A terminating comma (also called trailing comma) is
permitted after the last key/value pair.

```toml
name = {
first = "Tom",
last = "Preston-Werner",
}
point = { x = 1, y = 2 }
name = { first = "Tom", last = "Preston-Werner" }
point = {x=1, y=2}
animal = { type.name = "pug" }
contact = {
personal = {
name = "Donald Duck",
email = "[email protected]",
},
work = {
name = "Coin cleaner",
email = "[email protected]",
},
}
```

The inline tables above are identical to the following standard table
Expand All @@ -830,6 +839,14 @@ y = 2

[animal]
type.name = "pug"

[contact.personal]
name = "Donald Duck"
email = "[email protected]"

[contact.work]
name = "Coin cleaner"
email = "[email protected]"
```

Inline tables are fully self-contained and define all keys and sub-tables within
Expand Down

0 comments on commit d61fd93

Please sign in to comment.