ingydotnet / yaml-pm

YAML Perl Module
http://search.cpan.org/dist/YAML/
20 stars 27 forks source link

Support zero indented block sequences #207

Closed perlpunk closed 6 years ago

perlpunk commented 6 years ago

This patch will allow block sequences on the same level as the parent mapping, like:

x:
- a
- b
y: z

Both YAML 1.1 and 1.2 allow zero indented sequences.

There are people who insist that the Spec is inconsistent, and modules which produce zero indented sequences are broken.

So here are some quotes from the 1.2 spec which is similar to 1.1:

Since people perceive the “-” indicator as indentation, nested block sequences
may be indented by one less space to compensate, except, of course, if nested
inside another block sequence (block-out context vs. block-in context).
Example 8.22. Block Collection Nodes

sequence: !!seq
- entry
- !!seq
 - nested
mapping: !!map
 foo: bar

Fixes:

Related:

This will increase interoperability with YAML::XS and other processors.