2 test: Single ending newline
4 A pipe character, followed by an indented
5 block of text is treated as a literal
6 block, in which newlines are preserved
7 throughout the block, including the final
15 array('this' => "Foo\nBar\n")
17 test: The '+' indicator
19 The '+' indicator says to keep newlines at the end of text
23 extra new lines not kept
26 extra new lines are kept
32 'normal' => "extra new lines not kept\n",
33 'preserving' => "extra new lines are kept\n\n\n",
37 test: Three trailing newlines in literals
39 To give you more control over how space
40 is preserved in text blocks, YAML has
41 the keep '+' and chomp '-' indicators.
42 The keep indicator will preserve all
43 ending newlines, while the chomp indicator
44 will strip all ending newlines.
51 same as "clipped" above: "This has one newline.\n"
58 same as "stripped" above: "This has no newline."
61 This has four newlines.
65 same as "kept" above: "This has four newlines.\n\n\n\n"
68 'clipped' => "This has one newline.\n",
69 'same as "clipped" above' => "This has one newline.\n",
70 'stripped' => 'This has no newline.',
71 'same as "stripped" above' => 'This has no newline.',
72 'kept' => "This has four newlines.\n\n\n\n",
73 'same as "kept" above' => "This has four newlines.\n\n\n\n"
76 test: Extra trailing newlines with spaces
79 Normally, only a single newline is kept
80 from the end of a literal block, unless the
81 keep '+' character is used in combination
82 with the pipe. The following example
83 will preserve all ending whitespace
84 since the last line of both literal blocks
85 contains spaces which extend past the indentation
98 array('this' => "Foo\n\n \n",
99 'kept' => "Foo\n\n \n" )
102 test: Folded Block in a Sequence
104 A greater-then character, followed by an indented
105 block of text is treated as a folded block, in
106 which lines of text separated by a single newline
107 are concatenated as a single line.
121 "can't you see the beauty of yaml? hmm\n",
125 test: Folded Block as a Mapping Value
127 Both literal and folded blocks can be
128 used in collections, as values in a
129 sequence or a mapping.
139 'quote' => "Mark McGwire's year was crippled by a knee injury.\n",
143 test: Three trailing newlines in folded blocks
145 The keep and chomp indicators can also
146 be applied to folded blocks.
149 This has one newline.
153 same as "clipped" above: "This has one newline.\n"
160 same as "stripped" above: "This has no newline."
163 This has four newlines.
167 same as "kept" above: "This has four newlines.\n\n\n\n"
170 'clipped' => "This has one newline.\n",
171 'same as "clipped" above' => "This has one newline.\n",
172 'stripped' => 'This has no newline.',
173 'same as "stripped" above' => 'This has no newline.',
174 'kept' => "This has four newlines.\n\n\n\n",
175 'same as "kept" above' => "This has four newlines.\n\n\n\n"