1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128
|
%YAML 1.2
%TAG ! tag:yaml.org,2002: # primary tag handle
%TAG !! tag:yaml.org,2002: # secondary tag handle
%TAG !yaml! tag:yaml.org,2002: # named tag handle
---
- !str 0 # primary tag handle
- !!str 0 # secondary tag handle
- !yaml!str 0 # named tag handle
---
boolean: [false, true, FALSE, TRUE, False, True]
null: [null, ~,]
integer: [12345, -12_345, +12_345]
float: [
12345.15, -12_345.15, +12_345.15, 1.23015e+3,
-12_345.15e+10, +12_345.15e-10, 1.234_515e-10
]
binary: [0b101010, -0b1010_1010, +0b1010_1010]
octal: [0777, 0o777, +0777, -0o777]
hexadecimal: [0xFEFF_0000, -0xabcd_ef00, +0x1234_5678]
sexagesimal: [10:20:30, -19:29:39, +19:29:39]
infinity: [.inf, -.Inf, +.INF]
not a number: [.nan, .NaN, .NAN]
plain strings:
- a b c
- a:b & c @ d# e * f # comment
- {{ f(' ') }} #8234
double quoted strings:
- ""
- "a b c": "d e f" # comment
- "\\\"\a\b\f\n\r\t\v\0\_\ \N\L\P\x41\u0041\U00000041"
single quoted strings:
- ''
- 'a b c': 'd e f' # comment
- 'a''b''c'
block folded string: >
foo
bar: 1
baz: null
"qux"
block literal string: |
foo
bar: 1
baz: null
'qux'
chomping strings:
- block folded string: >- # comment
foo
bar: 1
- block literal string: |+ # comment
foo
bar: 1
- |- #11517
foo "\"
bar: 1
block indentation indicator:
- block folded string: >1 # comment
foo
bar: 1
- block literal string: |1- # comment
foo
bar: 1
- |-1 # comment
foo
bar: 1
flow collection:
empty sequence: []
empty mapping: {}
flow sequence: [foo, bar, baz]
flow mapping: {foo: bar, baz: qux}
flow string:
foo
bar
baz
"double quoted \" string": "
foo
bar
baz"
'single quoted '' string': '
foo
bar
baz'
inside block mapping:
foo: {bar: baz}
bar: ["foo": {baz: qux}]
flow:collection: [foo # comment
, {bar: [{ # comment
baz:
'
qux # not comment
' # comment
}]}]
explicit mapping:
? foo # comment
: bar # comment
? - foo
- bar
: - baz
- qux
? [1, 2, 3]
: ? 1
: one
? 2
: - ? 3
: three
- {?4: four, ? 5: five, ? # comment
6: # comment
{7:seven}}
mapping merge:
foo: &foo
bar: baz
bar:
<<: *foo
baz: &bar
foo: [*foo]
qux:
<<: [*foo, *bar]
baz: {<<: *foo, qux: [{<< : *foo}]}
|