Add some additional value quoting examples (#20464)

The existing examples in the "Gotchas" section were rather simple. Expanded upon those to add some additional clarity around how the quoting in YAML works.
This commit is contained in:
Chris Tooley 2017-03-05 03:27:54 -06:00 committed by scottb
parent df07866e8f
commit 6c2585f0c8

View file

@ -142,6 +142,16 @@ with a "{", YAML will think it is a dictionary, so you must quote it, like so::
foo: "{{ variable }}" foo: "{{ variable }}"
If your value starts with a quote the entire value must be quoted, not just part of it. Here are some additional examples of how to properly quote things::
foo: "{{ variable }}/additional/string/literal"
foo2: "{{ variable }}\\backslashes\\are\\also\\special\\characters"
foo3: "even if it's just a string literal it must all be quoted"
Not valid::
foo: "E:\\path\\"rest\\of\\path
The same applies for strings that start or contain any YAML special characters ``[] {} : > |`` . The same applies for strings that start or contain any YAML special characters ``[] {} : > |`` .
Boolean conversion is helpful, but this can be a problem when you want a literal `yes` or other boolean values as a string. Boolean conversion is helpful, but this can be a problem when you want a literal `yes` or other boolean values as a string.