Skip to content

Commit

Permalink
Added a lot more cases for enclosing strings with quotes
Browse files Browse the repository at this point in the history
  • Loading branch information
javiereguiluz committed Dec 16, 2014
1 parent ce6e3eb commit 63ea659
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions components/yaml/yaml_format.rst
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,19 @@ escaped with double quotes:
* ``\L``
* ``\P``

Finally, there are other cases when the strings must be quoted, no matter if
using single or double quotes:

* when the string is ``true`` or ``false`` (otherwise, it would be treated as a
boolean value);
* when the string is ``null`` or ``~`` (otherwise, it would be considered as a
``null`` value);
* when the string looks like a number, such as integers (e.g. ``2``, ``14``, etc.),
floats (e.g. ``2.6``, ``14.9``) and exponential numbers (e.g. ``12e7``, etc.)
(otherwise, it would be treated as a numeric value);
* when the string looks like a date (e.g. ``2014-12-31``) (otherwise it would be
automatically converted into a Unix timestamp).

When a string contains line breaks, you can use the literal style, indicated
by the pipe (``|``), to indicate that the string will span several lines. In
literals, newlines are preserved:
Expand Down

0 comments on commit 63ea659

Please sign in to comment.