OSDN Git Service

Regular updates
[twpd/master.git] / yaml.md
1 ---
2 title: Yaml
3 category: Markup
4 layout: 2017/sheet
5 prism_languages: [yaml]
6 ---
7
8 ### Dictionaries and lists
9
10 ```yaml
11 # comments start with "#"
12 # dictionary are written like "key: value"
13 name: Martin D'vloper
14 languages:
15   perl: Elite
16   python: Elite
17   pascal: Lame
18
19 # list items beginn with a "- "
20 foods:
21   - Apple
22   - Orange
23   - Strawberry
24   - Mango
25
26 # booleans are lower case
27 employed: true
28 ```
29
30
31 ### Multiline strings
32
33 ```yaml
34 # Literal Block Scalar
35 Multiline: |
36   exactly as you see
37   will appear these three
38   lines of poetry
39 ```
40
41 ```yaml
42 # Folded Block Scalar
43 Multiline: <
44   this is really a
45   single line of text
46   despite appearances
47 ```
48
49 ### Inheritance
50
51 ```yaml
52 parent: &defaults
53   a: 2
54   b: 3
55
56 child:
57   <<: *defaults
58   b: 4
59 ```
60
61 ### Reference content
62
63 ```yaml
64 values: &ref
65   - These values
66   - will be reused below
67   
68 other_values:
69   <<: *ref
70 ```