diff --git a/autotests/folding/test.yaml.fold b/autotests/folding/test.yaml.fold --- a/autotests/folding/test.yaml.fold +++ b/autotests/folding/test.yaml.fold @@ -68,11 +68,84 @@ center: &ORIGIN {x: 73, y: 129} radius: 7 -? | - This is a key - that has multiple lines -: and this is its value - ? - Dog - Cat : [ 2018-08-11, 2016-01-01 ] + +# Literal/Folded Style + +--- | + \//||\/|| + // || ||__ + +--- > + Mark McGwire's + year was crippled + by a knee injury. + +? | + This is a key + that has multiple lines +: | + and this is it's literal value + +# Capture the indentation of the Key. The "-" and "?" operators +# are considered as part of the indentation: +key1: + key2: !!hello | + literal: " text" # [ ] + + # literal { } + key3: |+ + literal: 'text' + no-literal: " text" + #comment + +? key: |- + literal: "text" + no-literal: "text" +- item1 + - item2 + - - - key: >- + "literal text" # [ ] + + 'literal block' + no-literal: 12 + +? - - - - ? key: | + literal: [ ] + no-literal: [ ] + +# Capture the indentation of the literal/folded operator: +|- + literal: "text" + +!!binary | + R0lGODlhDAAMAIQAAP//9/X + 17unp5WZmZgAAAOfn515eXv + Pz7Y6OjuDg4J+fn5OTk6enp + 56enmleECcgggoBADs= + +key1: + key2: + | + literal: "text" + key3: + !!str | + literal: "text" + #literal + +# Capture the indentation of the operators "-" or "?": +? - - - !!hello |+ + literal: "sdfsd" # [ ] + no-literal: "sdfsd" # [ ] + +- - - - >- + literal: "text" + #literal + no-literal: "text" + +# This implementation of literal blocks has a limitation: +# it only supports 6 dashes at most. +- - - - - - - key: | + literal? "dfsf" diff --git a/autotests/html/test.yaml.html b/autotests/html/test.yaml.html --- a/autotests/html/test.yaml.html +++ b/autotests/html/test.yaml.html @@ -74,12 +74,85 @@ center: &ORIGIN {x: 73, y: 129} radius: 7 -? | - This is a key - that has multiple lines -: and this is its value - ? - Dog - Cat : [ 2018-08-11, 2016-01-01 ] + +# Literal/Folded Style + +--- | + \//||\/|| + // || ||__ + +--- > + Mark McGwire's + year was crippled + by a knee injury. + +? | + This is a key + that has multiple lines +: | + and this is it's literal value + +# Capture the indentation of the Key. The "-" and "?" operators +# are considered as part of the indentation: +key1: + key2: !!hello | + literal: " text" # [ ] + + # literal { } + key3: |+ + literal: 'text' + no-literal: " text" + #comment + +? key: |- + literal: "text" + no-literal: "text" +- item1 + - item2 + - - - key: >- + "literal text" # [ ] + + 'literal block' + no-literal: 12 + +? - - - - ? key: | + literal: [ ] + no-literal: [ ] + +# Capture the indentation of the literal/folded operator: +|- + literal: "text" + +!!binary | + R0lGODlhDAAMAIQAAP//9/X + 17unp5WZmZgAAAOfn515eXv + Pz7Y6OjuDg4J+fn5OTk6enp + 56enmleECcgggoBADs= + +key1: + key2: + | + literal: "text" + key3: + !!str | + literal: "text" + #literal + +# Capture the indentation of the operators "-" or "?": +? - - - !!hello |+ + literal: "sdfsd" # [ ] + no-literal: "sdfsd" # [ ] + +- - - - >- + literal: "text" + #literal + no-literal: "text" + +# This implementation of literal blocks has a limitation: +# it only supports 6 dashes at most. +- - - - - - - key: | + literal? "dfsf" diff --git a/autotests/input/test.yaml b/autotests/input/test.yaml --- a/autotests/input/test.yaml +++ b/autotests/input/test.yaml @@ -68,11 +68,84 @@ center: &ORIGIN {x: 73, y: 129} radius: 7 +? - Dog + - Cat +: [ 2018-08-11, 2016-01-01 ] + +# Literal/Folded Style + +--- | + \//||\/|| + // || ||__ + +--- > + Mark McGwire's + year was crippled + by a knee injury. + ? | This is a key that has multiple lines -: and this is its value +: | + and this is it's literal value -? - Dog - - Cat -: [ 2018-08-11, 2016-01-01 ] +# Capture the indentation of the Key. The "-" and "?" operators +# are considered as part of the indentation: +key1: + key2: !!hello | + literal: " text" # [ ] + + # literal { } + key3: |+ + literal: 'text' + no-literal: " text" + #comment + +? key: |- + literal: "text" + no-literal: "text" +- item1 + - item2 + - - - key: >- + "literal text" # [ ] + + 'literal block' + no-literal: 12 + +? - - - - ? key: | + literal: [ ] + no-literal: [ ] + +# Capture the indentation of the literal/folded operator: +|- + literal: "text" + +!!binary | + R0lGODlhDAAMAIQAAP//9/X + 17unp5WZmZgAAAOfn515eXv + Pz7Y6OjuDg4J+fn5OTk6enp + 56enmleECcgggoBADs= + +key1: + key2: + | + literal: "text" + key3: + !!str | + literal: "text" + #literal + +# Capture the indentation of the operators "-" or "?": +? - - - !!hello |+ + literal: "sdfsd" # [ ] + no-literal: "sdfsd" # [ ] + +- - - - >- + literal: "text" + #literal + no-literal: "text" + +# This implementation of literal blocks has a limitation: +# it only supports 6 dashes at most. +- - - - - - - key: | + literal? "dfsf" diff --git a/autotests/reference/test.yaml.ref b/autotests/reference/test.yaml.ref --- a/autotests/reference/test.yaml.ref +++ b/autotests/reference/test.yaml.ref @@ -68,11 +68,84 @@ center: &ORIGIN {x: 73, y: 129}
radius: 7

-? |
- This is a key
- that has multiple lines
-: and this is its value
-
? - Dog
- Cat
: [ 2018-08-11, 2016-01-01 ]
+
+# Literal/Folded Style
+
+--- |
+ \//||\/||
+ // || ||__
+
+--- >
+ Mark McGwire's
+ year was crippled
+ by a knee injury.
+
+? |
+ This is a key
+ that has multiple lines
+: |
+ and this is it's literal value
+
+# Capture the indentation of the Key. The "-" and "?" operators
+# are considered as part of the indentation:
+key1:
+ key2: !!hello |
+ literal: " text" # [ ]
+
+ # literal { }
+ key3: |+
+ literal: 'text'
+ no-literal: " text"
+ #comment
+
+? key: |-
+ literal: "text"
+ no-literal: "text"
+- item1
+ - item2
+ - - - key: >-
+ "literal text" # [ ]
+
+ 'literal block'
+ no-literal: 12
+
+? - - - - ? key: |
+ literal: [ ]
+ no-literal: [ ]
+
+# Capture the indentation of the literal/folded operator:
+|-
+ literal: "text"
+
+!!binary |
+ R0lGODlhDAAMAIQAAP//9/X
+ 17unp5WZmZgAAAOfn515eXv
+ Pz7Y6OjuDg4J+fn5OTk6enp
+ 56enmleECcgggoBADs=
+
+key1:
+ key2:
+ |
+ literal: "text"
+ key3:
+ !!str |
+ literal: "text"
+ #literal
+
+# Capture the indentation of the operators "-" or "?":
+? - - - !!hello |+
+ literal: "sdfsd" # [ ]
+ no-literal: "sdfsd" # [ ]
+
+- - - - >-
+ literal: "text"
+ #literal
+ no-literal: "text"
+
+# This implementation of literal blocks has a limitation:
+# it only supports 6 dashes at most.
+- - - - - - - key: |
+ literal? "dfsf"
diff --git a/data/syntax/yaml.xml b/data/syntax/yaml.xml --- a/data/syntax/yaml.xml +++ b/data/syntax/yaml.xml @@ -16,15 +16,23 @@ - + + + + + + + + + + ]> - - //--> + @@ -34,10 +42,12 @@ - - + + + + @@ -47,19 +57,21 @@ - - - - + + + + + + - + @@ -72,11 +84,13 @@ - + + + @@ -158,9 +172,10 @@ - - - + + + + @@ -182,9 +197,10 @@ - - - + + + + @@ -259,6 +275,7 @@ + @@ -291,6 +308,232 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -309,11 +552,14 @@ + + +