YAML
YAML Ain't Markup Language
- skaláry - stringy, čísla, boolean
- sekvencie - polia, listy
- mappingy - hashe, slovníky
integer: 25
string: "25"
float: 25.0
boolean: true
foo: .inf
bar: -.Inf
plop: .NAN
foo: ~
bar: null
- true # boolean
- "true" # string, because it's quoted
- !!str true # string, because of !!str
- !!bool "true" # boolean, because of !!bool
Skaláry
# Jedno rozmerné
- Cat
- Dog
- Goldfish
# Multidimensional
-
- Cat
- Dog
- Goldfish
-
- Python
- Lion
- Tiger
Sekvencie
npcflag: [GOSSIP, VENDOR]
animal: pets
foo: { thing1: huey, thing2: louie, thing3: dewey }
Mappingy
# Príklad zápisov konfigurácii CI
# Azure devops
jobs:
- job: job1
steps:
- script: chmod +x ./script.sh
- script: ./script.sh
# CircleCI
jobs:
job1:
steps:
- checkout
- run: "execute-script-for-job1"
# Some future CI system, probably
jobs:
- steps: job1
- step1:
- script: chmod +x ./script.sh
- step2:
- run: "execute-script-for-job1-inside-step2"
# Zapíše a spojí na jeden riadok
bar: >
this is not a normal string it
spans more than
one line
see?
# Vidí ako
bar : this is not a normal string it spans more than one line see?
fold_some_newlines: >
a
b
c
d
e
f
same_as: "a b\nc d\n e\nf\n"
# Rešpektuje nový riadok
bar: |
this is not a normal string it
spans more than
one line
see?
# Vidí ako
bar : this is not a normal string it
spans more than
one line
see?
--- # Oddelenie viacerých dokumentov v jednom súbore
--- # Sequencer protocols for Laser eye surgery
- step: &id001 # defines anchor label &id001
instrument: Lasik 2000
pulseEnergy: 5.4
pulseDuration: 12
repetition: 1000
spotSize: 1mm
- step: &id002
instrument: Lasik 2000
pulseEnergy: 5.0
pulseDuration: 10
repetition: 500
spotSize: 2mm
- step: *id001 # refers to the first step (with anchor &id001)
- step: *id002 # refers to the second step
- step: *id002
- item1key1: "string1"
item1key2: "string2"
- item2key1: "string3"
item2key2: "string4"
# JSON
[{
item1key1: "string1",
item1key2: "string2"
},{
item2key1: "string3",
item2key2: "string4"
}]
YAML
By VeeeneX
YAML
- 5