1--- %YAML:1.0 2test: Simple Sequence 3brief: | 4 You can specify a list in YAML by placing each 5 member of the list on a new line with an opening 6 dash. These lists are called sequences. 7yaml: | 8 - apple 9 - banana 10 - carrot 11php: | 12 ['apple', 'banana', 'carrot'] 13--- 14test: Sequence With Item Being Null In The Middle 15brief: | 16 You can specify a list in YAML by placing each 17 member of the list on a new line with an opening 18 dash. These lists are called sequences. 19yaml: | 20 - apple 21 - 22 - carrot 23php: | 24 ['apple', null, 'carrot'] 25--- 26test: Sequence With Last Item Being Null 27brief: | 28 You can specify a list in YAML by placing each 29 member of the list on a new line with an opening 30 dash. These lists are called sequences. 31yaml: | 32 - apple 33 - banana 34 - 35php: | 36 ['apple', 'banana', null] 37--- 38test: Nested Sequences 39brief: | 40 You can include a sequence within another 41 sequence by giving the sequence an empty 42 dash, followed by an indented list. 43yaml: | 44 - 45 - foo 46 - bar 47 - baz 48php: | 49 [['foo', 'bar', 'baz']] 50--- 51test: Mixed Sequences 52brief: | 53 Sequences can contain any YAML data, 54 including strings and other sequences. 55yaml: | 56 - apple 57 - 58 - foo 59 - bar 60 - x123 61 - banana 62 - carrot 63php: | 64 ['apple', ['foo', 'bar', 'x123'], 'banana', 'carrot'] 65--- 66test: Deeply Nested Sequences 67brief: | 68 Sequences can be nested even deeper, with each 69 level of indentation representing a level of 70 depth. 71yaml: | 72 - 73 - 74 - uno 75 - dos 76php: | 77 [[['uno', 'dos']]] 78--- 79test: Simple Mapping 80brief: | 81 You can add a keyed list (also known as a dictionary or 82 hash) to your document by placing each member of the 83 list on a new line, with a colon separating the key 84 from its value. In YAML, this type of list is called 85 a mapping. 86yaml: | 87 foo: whatever 88 bar: stuff 89php: | 90 ['foo' => 'whatever', 'bar' => 'stuff'] 91--- 92test: Sequence in a Mapping 93brief: | 94 A value in a mapping can be a sequence. 95yaml: | 96 foo: whatever 97 bar: 98 - uno 99 - dos 100php: | 101 ['foo' => 'whatever', 'bar' => ['uno', 'dos']] 102--- 103test: Nested Mappings 104brief: | 105 A value in a mapping can be another mapping. 106yaml: | 107 foo: whatever 108 bar: 109 fruit: apple 110 name: steve 111 sport: baseball 112php: | 113 [ 114 'foo' => 'whatever', 115 'bar' => [ 116 'fruit' => 'apple', 117 'name' => 'steve', 118 'sport' => 'baseball' 119 ] 120 ] 121--- 122test: Mixed Mapping 123brief: | 124 A mapping can contain any assortment 125 of mappings and sequences as values. 126yaml: | 127 foo: whatever 128 bar: 129 - 130 fruit: apple 131 name: steve 132 sport: baseball 133 - more 134 - 135 python: rocks 136 perl: papers 137 ruby: scissorses 138php: | 139 [ 140 'foo' => 'whatever', 141 'bar' => [ 142 [ 143 'fruit' => 'apple', 144 'name' => 'steve', 145 'sport' => 'baseball' 146 ], 147 'more', 148 [ 149 'python' => 'rocks', 150 'perl' => 'papers', 151 'ruby' => 'scissorses' 152 ] 153 ] 154 ] 155--- 156test: Mapping-in-Sequence Shortcut 157todo: true 158brief: | 159 If you are adding a mapping to a sequence, you 160 can place the mapping on the same line as the 161 dash as a shortcut. 162yaml: | 163 - work on YAML.py: 164 - work on Store 165php: | 166 [['work on YAML.py' => ['work on Store']]] 167--- 168test: Sequence-in-Mapping Shortcut 169todo: true 170brief: | 171 The dash in a sequence counts as indentation, so 172 you can add a sequence inside of a mapping without 173 needing spaces as indentation. 174yaml: | 175 allow: 176 - 'localhost' 177 - '%.sourceforge.net' 178 - '%.freepan.org' 179php: | 180 ['allow' => ['localhost', '%.sourceforge.net', '%.freepan.org']] 181--- 182todo: true 183test: Merge key 184brief: | 185 A merge key ('<<') can be used in a mapping to insert other mappings. If 186 the value associated with the merge key is a mapping, each of its key/value 187 pairs is inserted into the current mapping. 188yaml: | 189 mapping: 190 name: Joe 191 job: Accountant 192 <<: 193 age: 38 194php: | 195 [ 196 'mapping' => 197 [ 198 'name' => 'Joe', 199 'job' => 'Accountant', 200 'age' => 38 201 ] 202 ] 203