From 8670035d19f1b0002344f0e17d2e09ce19223e7f Mon Sep 17 00:00:00 2001 From: Rudy Affandi Date: Sat, 31 Oct 2015 11:31:30 -0700 Subject: Add a note regarding string value of "1" Because some YAML parser will always assume that 1 is boolean for true. --- yaml.html.markdown | 2 ++ 1 file changed, 2 insertions(+) (limited to 'yaml.html.markdown') diff --git a/yaml.html.markdown b/yaml.html.markdown index 6e3e2c94..1d12fad7 100644 --- a/yaml.html.markdown +++ b/yaml.html.markdown @@ -24,6 +24,8 @@ YAML doesn't allow literal tab characters at all. key: value another_key: Another value goes here. a_number_value: 100 +# If you want to use number 1 as a value, you have to enclose it in quotes, +# otherwise, YAML parser will assume that it is a boolean value of true. scientific_notation: 1e+12 boolean: true null_value: null -- cgit v1.2.3 From d5e0a9fbf87e80427850e06511f768c19ebf74d7 Mon Sep 17 00:00:00 2001 From: Suhas Date: Wed, 4 Nov 2015 20:14:45 +0530 Subject: Add more complex key examples, and an example of inheritance --- yaml.html.markdown | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) (limited to 'yaml.html.markdown') diff --git a/yaml.html.markdown b/yaml.html.markdown index 6e3e2c94..62f08fb9 100644 --- a/yaml.html.markdown +++ b/yaml.html.markdown @@ -3,6 +3,7 @@ language: yaml filename: learnyaml.yaml contributors: - ["Adam Brenecki", "https://github.com/adambrenecki"] + - ["Suhas SG", "https://github.com/jargnar"] --- YAML is a data serialisation language designed to be directly writable and @@ -66,14 +67,19 @@ a_nested_map: # Maps don't have to have string keys. 0.25: a float key -# Keys can also be multi-line objects, using ? to indicate the start of a key. +# Keys can also be complex, like multi-line objects +# We use ? followed by a space to indicate the start of a complex key. ? | This is a key that has multiple lines : and this is its value -# YAML also allows collection types in keys, but many programming languages -# will complain. +# YAML also allows mapping between sequences with the complex key syntax +# Some language parsers might complain +# An example +? - Manchester United + - Real Madrid +: [ 2001-01-01, 2002-02-02 ] # Sequences (equivalent to lists or arrays) look like this: a_sequence: @@ -101,12 +107,31 @@ json_seq: [3, 2, 1, "takeoff"] anchored_content: &anchor_name This string will appear as the value of two keys. other_anchor: *anchor_name +# Anchors can be used to duplicate/inherit properties +base: &base + name: Everyone has same name + +foo: &foo + <<: *base + age: 10 + +bar: &bar + <<: *base + age: 20 + +# foo and bar would also have name: Everyone has same name + # YAML also has tags, which you can use to explicitly declare types. explicit_string: !!str 0.5 # Some parsers implement language specific tags, like this one for Python's # complex number type. python_complex_number: !!python/complex 1+2j +# We can also use yaml complex keys with language specific tags +? !!python/tuple [5, 7] +: Fifty Seven +# Would be {(5, 7): 'Fifty Seven'} in python + #################### # EXTRA YAML TYPES # #################### -- cgit v1.2.3 From 860fa9ebc732444693568fa9cf007d3c02fe72a2 Mon Sep 17 00:00:00 2001 From: Rodrigo Russo Date: Thu, 28 Apr 2016 09:06:12 +0200 Subject: [yaml/en] Add more resources (#1666) --- yaml.html.markdown | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'yaml.html.markdown') diff --git a/yaml.html.markdown b/yaml.html.markdown index 507c4d1f..a1ef0d38 100644 --- a/yaml.html.markdown +++ b/yaml.html.markdown @@ -164,3 +164,8 @@ set2: item2: null item3: null ``` + +### More Resources + ++ [YAML official website](http://yaml.org/) ++ [Online YAML Validator](http://codebeautify.org/yaml-validator) -- cgit v1.2.3 From ae1d18ad91a8563afe0e567f22912e6227be1a45 Mon Sep 17 00:00:00 2001 From: Samantha McVey Date: Fri, 11 Nov 2016 13:34:19 -0800 Subject: [yaml/en] Fix #2558 1 is interpreted as a number not as a boolean. For a boolean use we use true --- yaml.html.markdown | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'yaml.html.markdown') diff --git a/yaml.html.markdown b/yaml.html.markdown index a1ef0d38..95adbd83 100644 --- a/yaml.html.markdown +++ b/yaml.html.markdown @@ -25,9 +25,9 @@ YAML doesn't allow literal tab characters at all. key: value another_key: Another value goes here. a_number_value: 100 -# If you want to use number 1 as a value, you have to enclose it in quotes, -# otherwise, YAML parser will assume that it is a boolean value of true. scientific_notation: 1e+12 +# The number 1 will be interpreted as a number, not a boolean. if you want +# it to be intepreted as a boolean, use true boolean: true null_value: null key with spaces: value -- cgit v1.2.3 From 985d23a52b76593a120adff5381c2df3a80fe298 Mon Sep 17 00:00:00 2001 From: HairyFotr Date: Wed, 23 Aug 2017 10:14:39 +0200 Subject: Fix a bunch of typos --- yaml.html.markdown | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'yaml.html.markdown') diff --git a/yaml.html.markdown b/yaml.html.markdown index 95adbd83..3b32a069 100644 --- a/yaml.html.markdown +++ b/yaml.html.markdown @@ -27,7 +27,7 @@ another_key: Another value goes here. a_number_value: 100 scientific_notation: 1e+12 # The number 1 will be interpreted as a number, not a boolean. if you want -# it to be intepreted as a boolean, use true +# it to be interpreted as a boolean, use true boolean: true null_value: null key with spaces: value @@ -132,7 +132,7 @@ python_complex_number: !!python/complex 1+2j # We can also use yaml complex keys with language specific tags ? !!python/tuple [5, 7] : Fifty Seven -# Would be {(5, 7): 'Fifty Seven'} in python +# Would be {(5, 7): 'Fifty Seven'} in Python #################### # EXTRA YAML TYPES # -- cgit v1.2.3