KenKundert / nestedtext

Human readable and writable data interchange format
https://nestedtext.org
MIT License
362 stars 13 forks source link

dictionary nested in a list item #12

Closed freddrake closed 3 years ago

freddrake commented 3 years ago

The documentation seems to suggest that a list item can contain a nested dictionary:

A value for a dictionary or list item may be a rest-of-line string as shown above, or it may be a nested dictionary, list or a multiline string. (https://nestedtext.org/en/stable/how_to_write.html#nesting)

The example doesn't show an example of a dictionary nested into a list item, though.

The definition of a list item suggests that the value can only be a string:

A list item is introduced with a dash at the start of a line. Anything that follows the space after the dash is the value and is treated as a string. (https://nestedtext.org/en/stable/how_to_write.html#lists)

Is it possible to nest a dictionary inside a list item? An example would be very helpful.

KenKundert commented 3 years ago

Yes, it is possible for lists to hold dictionaries and visa versa. I have refined documentation to make this more clear. As for an example, I modified the introductory example to illustrate this. You can see it here. There are now two treasurers.