-
-
Save Muthuuk/cca8136960de9242e57749a8f19ccccb to your computer and use it in GitHub Desktop.
Revisions
-
jonschlinkert revised this gist
Mar 15, 2013 . 1 changed file with 14 additions and 14 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -8,11 +8,11 @@ name: Jon ``` yaml # YAML object: attributes: - attr1 - attr2 - attr3 methods: [ getter, setter ] ``` parses to this `json` @@ -23,9 +23,9 @@ parses to this `json` ``` yaml # YAML sonnet: | I wish I could write a poem but I can"t ``` parses to: @@ -45,16 +45,16 @@ document: this is doc 2 ```yaml name: SomeObject attributes: - attr1 - attr2 - attr3 methods: [ getter, setter ] --- name: MyPrettyObject attributes: - attr1 - attr2 - attr3 methods: [ getter, setter ] ``` parses to: -
jonschlinkert revised this gist
Mar 15, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -14,7 +14,7 @@ object: - attr3 methods: [ getter, setter ] ``` parses to this `json` ``` json {"object": {"attributes": ["attr1", "attr2", "attr3"], ... -
jonschlinkert revised this gist
Mar 15, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -30,7 +30,7 @@ sonnet: | parses to: ``` json {"sonnet": "I wish I could\nwrite a poem\nbut I can't\n"} ``` ``` yaml -
jonschlinkert revised this gist
Mar 15, 2013 . 1 changed file with 12 additions and 21 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -17,20 +17,20 @@ object: to `json` ``` json {"object": {"attributes": ["attr1", "attr2", "attr3"], ... ``` ``` yaml # YAML sonnet: | I wish I could write a poem but I can"t ``` parses to: ``` json {"sonnet": "I wish I could\nwrite a poem\nbut I can"t\n"} ``` ``` yaml @@ -60,14 +60,14 @@ methods: [ getter, setter ] parses to: ``` json {"attributes": ["attr1", "attr2", "attr3"], "methods": ["getter", "setter"], "name": "SomeObject"} {"attributes": ["attr1", "attr2", "attr3"], "methods": ["getter", "setter"], "name": "MyPrettyObject"} ``` YAML also supports variables, or **repeated nodes**. The simplest explanation is that you define something as a variable by preceding it with "&NAME value" and you can refer to it with "*NAME" e.g.: ``` yaml # YAML @@ -76,14 +76,5 @@ other_thing: *NAME ``` Parses to: ``` json {"other_thing": "foobar", "some_thing": "foobar"} ``` -
jonschlinkert revised this gist
Mar 15, 2013 . 1 changed file with 89 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,89 @@ adapted from [this blog](http://jessenoller.com/blog/2009/04/13/yaml-aint-markup-language-completely-different) ``` yaml # YAML name: Jon ``` ``` yaml # YAML object: attributes: - attr1 - attr2 - attr3 methods: [ getter, setter ] ``` to `json` ``` json {'object': {'attributes': ['attr1', 'attr2', 'attr3'], ... ``` ``` yaml # YAML sonnet: | I wish I could write a poem but I can't ``` parses to: ``` json {'sonnet': "I wish I could\nwrite a poem\nbut I can't\n"} ``` ``` yaml # YAML --- document: this is doc 1 --- document: this is doc 2 ... ``` ```yaml name: SomeObject attributes: - attr1 - attr2 - attr3 methods: [ getter, setter ] --- name: MyPrettyObject attributes: - attr1 - attr2 - attr3 methods: [ getter, setter ] ``` parses to: ``` json {'attributes': ['attr1', 'attr2', 'attr3'], 'methods': ['getter', 'setter'], 'name': 'SomeObject'} {'attributes': ['attr1', 'attr2', 'attr3'], 'methods': ['getter', 'setter'], 'name': 'MyPrettyObject'} ``` YAML also supports variables, or **repeated nodes**. The simplest explanation is that you define something as a variable by preceding it with ''&NAME value'' and you can refer to it with ''*NAME'' e.g.: ``` yaml # YAML some_thing: &NAME foobar other_thing: *NAME ``` Parses to: ``` json {'other_thing': 'foobar', 'some_thing': 'foobar'} ``` -
jonschlinkert revised this gist
Mar 15, 2013 . 1 changed file with 11 additions and 11 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ # YAML 1.1: Reference card --- ### Collection indicators: ``` yml '? ' : Key indicator. ': ' : Value indicator. @@ -9,7 +9,7 @@ '[]' : Surround in-line series branch. '{}' : Surround in-line keyed branch. ``` ### Scalar indicators: ``` yml '''' : Surround in-line unescaped scalar ('' escaped '). '"' : Surround in-line escaped scalar (see escape codes below). @@ -20,12 +20,12 @@ 1-9 : Explicit indentation modifier ('|1' or '>2'). # Modifiers can be combined ('|2-', '>+1'). ``` ### Alias indicators: ``` yml '&' : Anchor property. '*' : Alias indicator. ``` ### Tag property: # Usually unspecified. ``` yml none : Unspecified tag (automatically resolved by application). '!' : Non-specific tag (by default, "!!map"/"!!seq"/"!!str"). @@ -34,34 +34,34 @@ '!h!foo': Requires "%TAG !h! <prefix>" (and then means "<prefix>foo"). '!<foo>': Verbatim tag (always means "foo"). ``` ### Document indicators: ``` yml '%' : Directive indicator. '---': Document header. '...': Document terminator. ``` ### Misc indicators: ``` yml ' #' : Throwaway comment indicator. '`@' : Both reserved for future use. ``` ### Special keys: ``` yml '=' : Default "value" mapping key. '<<' : Merge keys from another mapping. ``` ### Core types: # Default automatic tags. ``` yml '!!map' : { Hash table, dictionary, mapping } '!!seq' : { List, array, tuple, vector, sequence } '!!str' : Unicode string ``` ### More types: ``` yml '!!set' : { cherries, plums, apples } '!!omap': [ one: 1, two: 2 ] ``` ### Language Independent Scalar types: ``` yml { ~, null } : Null (no value). [ 1234, 0x4D2, 02333 ] : [ Decimal int, Hexadecimal int, Octal int ] @@ -74,7 +74,7 @@ : >- Base 64 binary value. ``` ### Escape codes: ``` yml Numeric : { "\x12": 8-bit, "\u1234": 16-bit, "\U00102030": 32-bit } Protective: { "\\": '\', "\"": '"', "\ ": ' ', "\<TAB>": TAB } -
jonschlinkert revised this gist
Mar 15, 2013 . 1 changed file with 34 additions and 12 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,13 +1,16 @@ # YAML 1.1: Reference card --- ## Collection indicators: ``` yml '? ' : Key indicator. ': ' : Value indicator. '- ' : Nested series entry indicator. ', ' : Separate in-line branch entries. '[]' : Surround in-line series branch. '{}' : Surround in-line keyed branch. ``` ## Scalar indicators: ``` yml '''' : Surround in-line unescaped scalar ('' escaped '). '"' : Surround in-line escaped scalar (see escape codes below). '|' : Block scalar indicator. @@ -16,34 +19,50 @@ Scalar indicators: '+' : Keep chomp modifier ('|+' or '>+'). 1-9 : Explicit indentation modifier ('|1' or '>2'). # Modifiers can be combined ('|2-', '>+1'). ``` ## Alias indicators: ``` yml '&' : Anchor property. '*' : Alias indicator. ``` ## Tag property: # Usually unspecified. ``` yml none : Unspecified tag (automatically resolved by application). '!' : Non-specific tag (by default, "!!map"/"!!seq"/"!!str"). '!foo' : Primary (by convention, means a local "!foo" tag). '!!foo' : Secondary (by convention, means "tag:yaml.org,2002:foo"). '!h!foo': Requires "%TAG !h! <prefix>" (and then means "<prefix>foo"). '!<foo>': Verbatim tag (always means "foo"). ``` ## Document indicators: ``` yml '%' : Directive indicator. '---': Document header. '...': Document terminator. ``` ## Misc indicators: ``` yml ' #' : Throwaway comment indicator. '`@' : Both reserved for future use. ``` ## Special keys: ``` yml '=' : Default "value" mapping key. '<<' : Merge keys from another mapping. ``` ## Core types: # Default automatic tags. ``` yml '!!map' : { Hash table, dictionary, mapping } '!!seq' : { List, array, tuple, vector, sequence } '!!str' : Unicode string ``` ## More types: ``` yml '!!set' : { cherries, plums, apples } '!!omap': [ one: 1, two: 2 ] ``` ## Language Independent Scalar types: ``` yml { ~, null } : Null (no value). [ 1234, 0x4D2, 02333 ] : [ Decimal int, Hexadecimal int, Octal int ] [ 1_230.15, 12.3015e+02 ]: [ Fixed float, Exponential float ] @@ -54,9 +73,12 @@ Language Independent Scalar types: R0lG...BADS= : >- Base 64 binary value. ``` ## Escape codes: ``` yml Numeric : { "\x12": 8-bit, "\u1234": 16-bit, "\U00102030": 32-bit } Protective: { "\\": '\', "\"": '"', "\ ": ' ', "\<TAB>": TAB } C : { "\0": NUL, "\a": BEL, "\b": BS, "\f": FF, "\n": LF, "\r": CR, "\t": TAB, "\v": VTAB } Additional: { "\e": ESC, "\_": NBSP, "\N": NEL, "\L": LS, "\P": PS } ``` -
jonschlinkert revised this gist
Mar 15, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ # YAML 1.1: Reference card --- Collection indicators: '? ' : Key indicator. -
jonschlinkert created this gist
Mar 15, 2013 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,62 @@ %YAML 1.1 # Reference card --- Collection indicators: '? ' : Key indicator. ': ' : Value indicator. '- ' : Nested series entry indicator. ', ' : Separate in-line branch entries. '[]' : Surround in-line series branch. '{}' : Surround in-line keyed branch. Scalar indicators: '''' : Surround in-line unescaped scalar ('' escaped '). '"' : Surround in-line escaped scalar (see escape codes below). '|' : Block scalar indicator. '>' : Folded scalar indicator. '-' : Strip chomp modifier ('|-' or '>-'). '+' : Keep chomp modifier ('|+' or '>+'). 1-9 : Explicit indentation modifier ('|1' or '>2'). # Modifiers can be combined ('|2-', '>+1'). Alias indicators: '&' : Anchor property. '*' : Alias indicator. Tag property: # Usually unspecified. none : Unspecified tag (automatically resolved by application). '!' : Non-specific tag (by default, "!!map"/"!!seq"/"!!str"). '!foo' : Primary (by convention, means a local "!foo" tag). '!!foo' : Secondary (by convention, means "tag:yaml.org,2002:foo"). '!h!foo': Requires "%TAG !h! <prefix>" (and then means "<prefix>foo"). '!<foo>': Verbatim tag (always means "foo"). Document indicators: '%' : Directive indicator. '---': Document header. '...': Document terminator. Misc indicators: ' #' : Throwaway comment indicator. '`@' : Both reserved for future use. Special keys: '=' : Default "value" mapping key. '<<' : Merge keys from another mapping. Core types: # Default automatic tags. '!!map' : { Hash table, dictionary, mapping } '!!seq' : { List, array, tuple, vector, sequence } '!!str' : Unicode string More types: '!!set' : { cherries, plums, apples } '!!omap': [ one: 1, two: 2 ] Language Independent Scalar types: { ~, null } : Null (no value). [ 1234, 0x4D2, 02333 ] : [ Decimal int, Hexadecimal int, Octal int ] [ 1_230.15, 12.3015e+02 ]: [ Fixed float, Exponential float ] [ .inf, -.Inf, .NAN ] : [ Infinity (float), Negative, Not a number ] { Y, true, Yes, ON } : Boolean true { n, FALSE, No, off } : Boolean false ? !!binary > R0lG...BADS= : >- Base 64 binary value. Escape codes: Numeric : { "\x12": 8-bit, "\u1234": 16-bit, "\U00102030": 32-bit } Protective: { "\\": '\', "\"": '"', "\ ": ' ', "\<TAB>": TAB } C : { "\0": NUL, "\a": BEL, "\b": BS, "\f": FF, "\n": LF, "\r": CR, "\t": TAB, "\v": VTAB } Additional: { "\e": ESC, "\_": NBSP, "\N": NEL, "\L": LS, "\P": PS } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,62 @@ %YAML 1.1 # Reference card --- Collection indicators: '? ' : Key indicator. ': ' : Value indicator. '- ' : Nested series entry indicator. ', ' : Separate in-line branch entries. '[]' : Surround in-line series branch. '{}' : Surround in-line keyed branch. Scalar indicators: '''' : Surround in-line unescaped scalar ('' escaped '). '"' : Surround in-line escaped scalar (see escape codes below). '|' : Block scalar indicator. '>' : Folded scalar indicator. '-' : Strip chomp modifier ('|-' or '>-'). '+' : Keep chomp modifier ('|+' or '>+'). 1-9 : Explicit indentation modifier ('|1' or '>2'). # Modifiers can be combined ('|2-', '>+1'). Alias indicators: '&' : Anchor property. '*' : Alias indicator. Tag property: # Usually unspecified. none : Unspecified tag (automatically resolved by application). '!' : Non-specific tag (by default, "!!map"/"!!seq"/"!!str"). '!foo' : Primary (by convention, means a local "!foo" tag). '!!foo' : Secondary (by convention, means "tag:yaml.org,2002:foo"). '!h!foo': Requires "%TAG !h! <prefix>" (and then means "<prefix>foo"). '!<foo>': Verbatim tag (always means "foo"). Document indicators: '%' : Directive indicator. '---': Document header. '...': Document terminator. Misc indicators: ' #' : Throwaway comment indicator. '`@' : Both reserved for future use. Special keys: '=' : Default "value" mapping key. '<<' : Merge keys from another mapping. Core types: # Default automatic tags. '!!map' : { Hash table, dictionary, mapping } '!!seq' : { List, array, tuple, vector, sequence } '!!str' : Unicode string More types: '!!set' : { cherries, plums, apples } '!!omap': [ one: 1, two: 2 ] Language Independent Scalar types: { ~, null } : Null (no value). [ 1234, 0x4D2, 02333 ] : [ Decimal int, Hexadecimal int, Octal int ] [ 1_230.15, 12.3015e+02 ]: [ Fixed float, Exponential float ] [ .inf, -.Inf, .NAN ] : [ Infinity (float), Negative, Not a number ] { Y, true, Yes, ON } : Boolean true { n, FALSE, No, off } : Boolean false ? !!binary > R0lG...BADS= : >- Base 64 binary value. Escape codes: Numeric : { "\x12": 8-bit, "\u1234": 16-bit, "\U00102030": 32-bit } Protective: { "\\": '\', "\"": '"', "\ ": ' ', "\<TAB>": TAB } C : { "\0": NUL, "\a": BEL, "\b": BS, "\f": FF, "\n": LF, "\r": CR, "\t": TAB, "\v": VTAB } Additional: { "\e": ESC, "\_": NBSP, "\N": NEL, "\L": LS, "\P": PS }