-
Notifications
You must be signed in to change notification settings - Fork 614
More detailed info on block scalars #2319
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: devel
Are you sure you want to change the base?
Conversation
Thanks for your Ansible docs contribution! We talk about Ansible documentation on Matrix at #docs:ansible.im if you ever want to join us and chat about the docs! We meet on Matrix every Tuesday. See the Ansible calendar for meeting details. We welcome additions to our weekly agenda items too. You can add the |
Thanks for your contribution, @kk-at-redhat! Please make sure that your pull request includes sufficient and meaningful details in the description. |
@@ -68,19 +66,18 @@ More complicated data structures are possible, such as lists of dictionaries, di | |||
- fortran | |||
- erlang | |||
|
|||
Dictionaries and lists can also be represented in an abbreviated form if you really want to: | |||
Dictionaries and lists can also be written in a short form called "Flow collections": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
aka YAML shorthand, which is also a superset of JSON
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a suggested addition?
|
||
There's another small quirk to YAML. All YAML files (regardless of their association with Ansible or not) can optionally | ||
begin with ``---`` and end with ``...``. This is part of the YAML format and indicates the start and end of a document. | ||
One of the most common structures that can be found in a yaml file is a list. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One of the most common structures that can be found in a yaml file is a list. | |
Ansible playbooks and task files are lists. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer to leave it as it was since at this point we are talking about yaml in general (regardless of its association with Ansible). Also, variables file being a dictionary can still have fields that are lists and thus we can say that lists can be found in those files too even though the files are dictionaries.
@@ -38,7 +36,7 @@ All members of a list are lines beginning at the same indentation level starting | |||
- Mango | |||
... | |||
|
|||
A dictionary is represented in a simple ``key: value`` form (the colon must be followed by a space): | |||
Another common structure is a dictionary which consists of one or more key/value pairs: ``key: value`` (the colon must be followed by a space): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dictionaries don't need to contain at least one key/value pair.
Another common structure is a dictionary which consists of one or more key/value pairs: ``key: value`` (the colon must be followed by a space): | |
Ansible variable files are dictionaries. | |
A YAML dictionary is represented in a simple ``key: value`` form (the colon must be followed by a space): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dictionaries don't need to contain at least one key/value pair.
Meaning empty dictionary? Formally it's correct, of course, but I think for the purposes of the doc it's not relevant really.
Also, if we get into saying that a certain yaml file is a list or a dictionary then the next question would be: is empty yaml file an empty list or empty dictionary, lol? I'm not sure we want to put ourselves in that discussion :-) I'd prefer to keep my version if possible.
Co-authored-by: Sloane Hertel <[email protected]>
Co-authored-by: Sloane Hertel <[email protected]>
Co-authored-by: Sloane Hertel <[email protected]>
Co-authored-by: Sloane Hertel <[email protected]>
No description provided.