summaryrefslogtreecommitdiffstats
path: root/docs
diff options
context:
space:
mode:
authoritchyny <itchyny@cybozu.co.jp>2023-07-22 15:38:25 +0900
committerNico Williams <nico@cryptonector.com>2023-07-22 19:00:16 -0500
commit34629ed223a058cf5122f1494b753d85cf5a4be5 (patch)
tree7602cdf0e333d0764b24e1d11f9903aa47811fd5 /docs
parent9044f540bbf4959fc3720c352742f2800411946e (diff)
Fix manual source code to follow the schema definition
Diffstat (limited to 'docs')
-rw-r--r--docs/content/manual/manual.yml41
-rw-r--r--docs/content/manual/v1.3/manual.yml22
-rw-r--r--docs/content/manual/v1.4/manual.yml28
-rw-r--r--docs/content/manual/v1.5/manual.yml69
-rw-r--r--docs/content/manual/v1.6/manual.yml73
5 files changed, 108 insertions, 125 deletions
diff --git a/docs/content/manual/manual.yml b/docs/content/manual/manual.yml
index ff68482a..15495b3c 100644
--- a/docs/content/manual/manual.yml
+++ b/docs/content/manual/manual.yml
@@ -404,7 +404,7 @@ sections:
examples:
- program: '.foo'
input: '{"foo": 42, "bar": "less interesting data"}'
- output: [42]
+ output: ['42']
- program: '.foo'
input: '{"notfoo": true, "alsonotfoo": false}'
@@ -412,7 +412,7 @@ sections:
- program: '.["foo"]'
input: '{"foo": 42}'
- output: [42]
+ output: ['42']
- title: "Optional Object Identifier-Index: `.foo?`"
body: |
@@ -423,13 +423,13 @@ sections:
examples:
- program: '.foo?'
input: '{"foo": 42, "bar": "less interesting data"}'
- output: [42]
+ output: ['42']
- program: '.foo?'
input: '{"notfoo": true, "alsonotfoo": false}'
output: ['null']
- program: '.["foo"]?'
input: '{"foo": 42}'
- output: [42]
+ output: ['42']
- program: '[.foo?]'
input: '[1,2]'
output: ['[]']
@@ -583,7 +583,7 @@ sections:
examples:
- program: '(. + 2) * 5'
input: '1'
- output: [15]
+ output: ['15']
- title: Types and Values
body: |
@@ -825,8 +825,8 @@ sections:
examples:
- program: '10 / . * 3'
- input: 5
- output: [6]
+ input: '5'
+ output: ['6']
- program: '. / ", "'
input: '"a, b,c,d, e"'
output: ['["a","b,c,d","e"]']
@@ -861,7 +861,7 @@ sections:
examples:
- program: '.[] | length'
input: '[[1,2], "string", {"a":2}, null, -5]'
- output: [2, 6, 1, 0, 5]
+ output: ['2', '6', '1', '0', '5']
- title: "`utf8bytelength`"
@@ -873,7 +873,7 @@ sections:
examples:
- program: 'utf8bytelength'
input: '"\u03bc"'
- output: [2]
+ output: ['2']
- title: "`keys`, `keys_unsorted`"
body: |
@@ -1175,7 +1175,7 @@ sections:
examples:
- program: '1, empty, 2'
input: 'null'
- output: [1, 2]
+ output: ['1', '2']
- program: '[1,2,empty,3]'
input: 'null'
output: ['[1,2,3]']
@@ -1253,7 +1253,7 @@ sections:
output: ['"abc"']
- program: add
input: '[1, 2, 3]'
- output: [6]
+ output: ['6']
- program: add
input: '[]'
output: ["null"]
@@ -1402,7 +1402,7 @@ sections:
examples:
- program: '.[] | tonumber'
input: '[1, "1"]'
- output: [1, 1]
+ output: ['1', '1']
- title: "`tostring`"
body: |
@@ -1867,11 +1867,8 @@ sections:
- '1'
- program: 'recurse(. * .; . < 20)'
- input: 2
- output:
- - 2
- - 4
- - 16
+ input: '2'
+ output: ['2', '4', '16']
- title: "`walk(f)`"
body: |
@@ -2258,7 +2255,7 @@ sections:
else
"many"
end
- input: 2
+ input: '2'
output: ['"many"']
- title: "`>`, `>=`, `<=`, `<`"
@@ -2273,7 +2270,7 @@ sections:
examples:
- program: '. < 5'
- input: 2
+ input: '2'
output: ['true']
- title: "`and`, `or`, `not`"
@@ -2329,10 +2326,10 @@ sections:
examples:
- program: '.foo // 42'
input: '{"foo": 19}'
- output: [19]
+ output: ['19']
- program: '.foo // 42'
input: '{}'
- output: [42]
+ output: ['42']
- title: try-catch
body: |
@@ -2510,7 +2507,7 @@ sections:
- program: '[ match("."; "g")] | length'
input: '"abc"'
- output: [3]
+ output: ['3']
- title: "`capture(val)`, `capture(regex; flags)`"
diff --git a/docs/content/manual/v1.3/manual.yml b/docs/content/manual/v1.3/manual.yml
index 34ddcf72..5679a299 100644
--- a/docs/content/manual/v1.3/manual.yml
+++ b/docs/content/manual/v1.3/manual.yml
@@ -162,7 +162,7 @@ sections:
examples:
- program: '.foo'
input: '{"foo": 42, "bar": "less interesting data"}'
- output: [42]
+ output: ['42']
- program: '.foo'
input: '{"notfoo": true, "alsonotfoo": false}'
output: ['null']
@@ -438,8 +438,8 @@ sections:
examples:
- program: '10 / . * 3'
- input: 5
- output: [6]
+ input: '5'
+ output: ['6']
- title: '`length`'
body: |
@@ -460,7 +460,7 @@ sections:
examples:
- program: '.[] | length'
input: '[[1,2], "string", {"a":2}, null]'
- output: [2, 6, 1, 0]
+ output: ['2', '6', '1', '0']
- title: '`keys`'
body: |
@@ -554,7 +554,7 @@ sections:
examples:
- program: '1, empty, 2'
input: 'null'
- output: [1, 2]
+ output: ['1', '2']
- program: '[1,2,empty,3]'
input: 'null'
output: ['[1,2,3]']
@@ -591,7 +591,7 @@ sections:
output: ['"abc"']
- program: add
input: '[1, 2, 3]'
- output: [6]
+ output: ['6']
- program: add
input: '[]'
output: ["null"]
@@ -622,7 +622,7 @@ sections:
examples:
- program: '.[] | tonumber'
input: '[1, "1"]'
- output: [1, 1]
+ output: ['1', '1']
- title: '`tostring`'
body: |
@@ -925,7 +925,7 @@ sections:
else
"many"
end
- input: 2
+ input: '2'
output: ['"many"']
- title: "`>`, `>=`, `<=`, `<`"
@@ -940,7 +940,7 @@ sections:
examples:
- program: '. < 5'
- input: 2
+ input: '2'
output: ['true']
- title: "`and`, `or`, `not`"
@@ -996,10 +996,10 @@ sections:
examples:
- program: '.foo // 42'
input: '{"foo": 19}'
- output: [19]
+ output: ['19']
- program: '.foo // 42'
input: '{}'
- output: [42]
+ output: ['42']
- title: Advanced features
body: |
diff --git a/docs/content/manual/v1.4/manual.yml b/docs/content/manual/v1.4/manual.yml
index b51b3b1a..bca53755 100644
--- a/docs/content/manual/v1.4/manual.yml
+++ b/docs/content/manual/v1.4/manual.yml
@@ -220,13 +220,13 @@ sections:
examples:
- program: '.foo'
input: '{"foo": 42, "bar": "less interesting data"}'
- output: [42]
+ output: ['42']
- program: '.foo'
input: '{"notfoo": true, "alsonotfoo": false}'
output: ['null']
- program: '.["foo"]'
input: '{"foo": 42}'
- output: [42]
+ output: ['42']
- title: "`.foo?`"
body: |
@@ -237,13 +237,13 @@ sections:
examples:
- program: '.foo?'
input: '{"foo": 42, "bar": "less interesting data"}'
- output: [42]
+ output: ['42']
- program: '.foo?'
input: '{"notfoo": true, "alsonotfoo": false}'
output: ['null']
- program: '.["foo"]?'
input: '{"foo": 42}'
- output: [42]
+ output: ['42']
- program: '[.foo?]'
input: '[1,2]'
output: ['[]']
@@ -546,8 +546,8 @@ sections:
examples:
- program: '10 / . * 3'
- input: 5
- output: [6]
+ input: '5'
+ output: ['6']
- program: '. / ", "'
input: '"a, b,c,d, e"'
output: ['["a","b,c,d","e"]']
@@ -574,7 +574,7 @@ sections:
examples:
- program: '.[] | length'
input: '[[1,2], "string", {"a":2}, null]'
- output: [2, 6, 1, 0]
+ output: ['2', '6', '1', '0']
- title: "`keys`"
body: |
@@ -695,7 +695,7 @@ sections:
examples:
- program: '1, empty, 2'
input: 'null'
- output: [1, 2]
+ output: ['1', '2']
- program: '[1,2,empty,3]'
input: 'null'
output: ['[1,2,3]']
@@ -758,7 +758,7 @@ sections:
output: ['"abc"']
- program: add
input: '[1, 2, 3]'
- output: [6]
+ output: ['6']
- program: add
input: '[]'
output: ["null"]
@@ -849,7 +849,7 @@ sections:
examples:
- program: '.[] | tonumber'
input: '[1, "1"]'
- output: [1, 1]
+ output: ['1', '1']
- title: "`tostring`"
body: |
@@ -1327,7 +1327,7 @@ sections:
else
"many"
end
- input: 2
+ input: '2'
output: ['"many"']
- title: "`>`, `>=`, `<=`, `<`"
@@ -1342,7 +1342,7 @@ sections:
examples:
- program: '. < 5'
- input: 2
+ input: '2'
output: ['true']
- title: "`and`, `or`, `not`"
@@ -1398,10 +1398,10 @@ sections:
examples:
- program: '.foo // 42'
input: '{"foo": 19}'
- output: [19]
+ output: ['19']
- program: '.foo // 42'
input: '{}'
- output: [42]
+ output: ['42']
- title: Advanced features
body: |
diff --git a/docs/content/manual/v1.5/manual.yml b/docs/content/manual/v1.5/manual.yml
index 2274bc87..5b197731 100644
--- a/docs/content/manual/v1.5/manual.yml
+++ b/docs/content/manual/v1.5/manual.yml
@@ -286,13 +286,13 @@ sections:
examples:
- program: '.foo'
input: '{"foo": 42, "bar": "less interesting data"}'
- output: [42]
+ output: ['42']
- program: '.foo'
input: '{"notfoo": true, "alsonotfoo": false}'
output: ['null']
- program: '.["foo"]'
input: '{"foo": 42}'
- output: [42]
+ output: ['42']
- title: "`.foo?`"
body: |
@@ -303,13 +303,13 @@ sections:
examples:
- program: '.foo?'
input: '{"foo": 42, "bar": "less interesting data"}'
- output: [42]
+ output: ['42']
- program: '.foo?'
input: '{"notfoo": true, "alsonotfoo": false}'
output: ['null']
- program: '.["foo"]?'
input: '{"foo": 42}'
- output: [42]
+ output: ['42']
- program: '[.foo?]'
input: '[1,2]'
output: ['[]']
@@ -628,8 +628,8 @@ sections:
examples:
- program: '10 / . * 3'
- input: 5
- output: [6]
+ input: '5'
+ output: ['6']
- program: '. / ", "'
input: '"a, b,c,d, e"'
output: ['["a","b,c,d","e"]']
@@ -660,7 +660,7 @@ sections:
examples:
- program: '.[] | length'
input: '[[1,2], "string", {"a":2}, null]'
- output: [2, 6, 1, 0]
+ output: ['2', '6', '1', '0']
- title: "`keys`, `keys_unsorted`"
body: |
@@ -838,7 +838,7 @@ sections:
examples:
- program: '1, empty, 2'
input: 'null'
- output: [1, 2]
+ output: ['1', '2']
- program: '[1,2,empty,3]'
input: 'null'
output: ['[1,2,3]']
@@ -923,7 +923,7 @@ sections:
output: ['"abc"']
- program: add
input: '[1, 2, 3]'
- output: [6]
+ output: ['6']
- program: add
input: '[]'
output: ["null"]
@@ -1072,7 +1072,7 @@ sections:
examples:
- program: '.[] | tonumber'
input: '[1, "1"]'
- output: [1, 1]
+ output: ['1', '1']
- title: "`tostring`"
body: |
@@ -1416,10 +1416,10 @@ sections:
Emit a copy of the input string with its alphabetic characters (a-z and A-Z)
converted to the specified case.
- example:
+ examples:
- program: 'ascii_upcase'
input: '"useful but not for é"'
- output: '"USEFUL BUT NOT FOR é"'
+ output: ['"USEFUL BUT NOT FOR é"']
- title: "`while(cond; update)`"
body: |
@@ -1516,11 +1516,8 @@ sections:
- '1'
- program: 'recurse(. * .; . < 20)'
- input: 2
- output:
- - 2
- - 4
- - 16
+ input: '2'
+ output: ['2', '4', '16']
- title: "`..`"
body: |
@@ -1805,7 +1802,7 @@ sections:
else
"many"
end
- input: 2
+ input: '2'
output: ['"many"']
- title: "`>`, `>=`, `<=`, `<`"
@@ -1820,7 +1817,7 @@ sections:
examples:
- program: '. < 5'
- input: 2
+ input: '2'
output: ['true']
- title: "`and`, `or`, `not`"
@@ -1876,10 +1873,10 @@ sections:
examples:
- program: '.foo // 42'
input: '{"foo": 19}'
- output: [19]
+ output: ['19']
- program: '.foo // 42'
input: '{}'
- output: [42]
+ output: ['42']
- title: try-catch
body: |
@@ -2047,7 +2044,7 @@ sections:
- program: '[ match("."; "g")] | length'
input: '"abc"'
- output: [3]
+ output: ['3']
- title: "`capture(val)`, `capture(regex; flags)`"
@@ -2071,24 +2068,20 @@ sections:
To capture all the matches for each input string, use the idiom
`[ expr ]`, e.g. `[ scan(regex) ]`.
- example:
+ examples:
- program: 'scan("c")'
input: '"abcdefabc"'
output: ['"c"', '"c"']
- - program: 'scan("b")'
- input: ("", "")
- output: ['[]', '[]']
-
- title: "`split(regex; flags)`"
body: |
For backwards compatibility, `split` splits on a string, not a regex.
- example:
+ examples:
- program: 'split(", *"; null)'
input: '"ab,cd, ef"'
- output: ['"ab","cd","ef"']
+ output: ['["ab","cd","ef"]']
- title: "`splits(regex)`, `splits(regex; flags)`"
@@ -2097,10 +2090,10 @@ sections:
These provide the same results as their `split` counterparts,
but as a stream instead of an array.
- example:
+ examples:
- program: 'splits(", *")'
- input: '("ab,cd", "ef, gh")'
- output: ['"ab"', '"cd"', '"ef"', '"gh"']
+ input: '"ab,cd, ef, gh"'
+ output: ['"ab"','"cd"','"ef"','"gh"']
- title: "`sub(regex; tostring)` `sub(regex; string; flags)`"
body: |
@@ -2112,10 +2105,10 @@ sections:
constructed by `capture`) to `tostring`, so a reference to a captured
variable named "x" would take the form: `"\(.x)"`.
- example:
- - program: 'sub("^[^a-z]*(?<x>[a-z]*).*")'
- input: '"123abc456"'
- output: '"ZabcZabc"'
+ examples:
+ - program: 'sub("[^a-z]*(?<x>[a-z]+)"; "Z\(.x)"; "g")'
+ input: '"123abc456def"'
+ output: ['"ZabcZdef"']
- title: "`gsub(regex; string)`, `gsub(regex; string; flags)`"
@@ -2124,10 +2117,10 @@ sections:
`gsub` is like `sub` but all the non-overlapping occurrences of the regex are
replaced by the string, after interpolation.
- example:
+ examples:
- program: 'gsub("(?<x>.)[^a]*"; "+\(.x)-")'
input: '"Abcabc"'
- output: '"+A-+a-"'
+ output: ['"+A-+a-"']
- title: Advanced features
diff --git a/docs/content/manual/v1.6/manual.yml b/docs/content/manual/v1.6/manual.yml
index e4b7e229..ff27974c 100644
--- a/docs/content/manual/v1.6/manual.yml
+++ b/docs/content/manual/v1.6/manual.yml
@@ -329,13 +329,13 @@ sections:
examples:
- program: '.foo'
input: '{"foo": 42, "bar": "less interesting data"}'
- output: [42]
+ output: ['42']
- program: '.foo'
input: '{"notfoo": true, "alsonotfoo": false}'
output: ['null']
- program: '.["foo"]'
input: '{"foo": 42}'
- output: [42]
+ output: ['42']
- title: "Optional Object Identifier-Index: `.foo?`"
body: |
@@ -346,13 +346,13 @@ sections:
examples:
- program: '.foo?'
input: '{"foo": 42, "bar": "less interesting data"}'
- output: [42]
+ output: ['42']
- program: '.foo?'
input: '{"notfoo": true, "alsonotfoo": false}'
output: ['null']
- program: '.["foo"]?'
input: '{"foo": 42}'
- output: [42]
+ output: ['42']
- program: '[.foo?]'
input: '[1,2]'
output: ['[]']
@@ -506,7 +506,7 @@ sections:
examples:
- program: '(. + 2) * 5'
input: '1'
- output: [15]
+ output: ['15']
- title: Types and Values
body: |
@@ -713,8 +713,8 @@ sections:
examples:
- program: '10 / . * 3'
- input: 5
- output: [6]
+ input: '5'
+ output: ['6']
- program: '. / ", "'
input: '"a, b,c,d, e"'
output: ['["a","b,c,d","e"]']
@@ -749,7 +749,7 @@ sections:
examples:
- program: '.[] | length'
input: '[[1,2], "string", {"a":2}, null, -5]'
- output: [2, 6, 1, 0, 5]
+ output: ['2', '6', '1', '0', '5']
- title: "`utf8bytelength`"
@@ -761,7 +761,7 @@ sections:
examples:
- program: 'utf8bytelength'
input: '"\u03bc"'
- output: [2]
+ output: ['2']
- title: "`keys`, `keys_unsorted`"
body: |
@@ -1003,7 +1003,7 @@ sections:
examples:
- program: '1, empty, 2'
input: 'null'
- output: [1, 2]
+ output: ['1', '2']
- program: '[1,2,empty,3]'
input: 'null'
output: ['[1,2,3]']
@@ -1084,7 +1084,7 @@ sections:
output: ['"abc"']
- program: add
input: '[1, 2, 3]'
- output: [6]
+ output: ['6']
- program: add
input: '[]'
output: ["null"]
@@ -1233,7 +1233,7 @@ sections:
examples:
- program: '.[] | tonumber'
input: '[1, "1"]'
- output: [1, 1]
+ output: ['1', '1']
- title: "`tostring`"
body: |
@@ -1583,10 +1583,10 @@ sections:
Emit a copy of the input string with its alphabetic characters (a-z and A-Z)
converted to the specified case.
- example:
+ examples:
- program: 'ascii_upcase'
input: '"useful but not for é"'
- output: '"USEFUL BUT NOT FOR é"'
+ output: ['"USEFUL BUT NOT FOR é"']
- title: "`while(cond; update)`"
body: |
@@ -1683,11 +1683,8 @@ sections:
- '1'
- program: 'recurse(. * .; . < 20)'
- input: 2
- output:
- - 2
- - 4
- - 16
+ input: '2'
+ output: ['2', '4', '16']
- title: "`walk(f)`"
body: |
@@ -2062,7 +2059,7 @@ sections:
else
"many"
end
- input: 2
+ input: '2'
output: ['"many"']
- title: "`>`, `>=`, `<=`, `<`"
@@ -2077,7 +2074,7 @@ sections:
examples:
- program: '. < 5'
- input: 2
+ input: '2'
output: ['true']
- title: "`and`, `or`, `not`"
@@ -2133,10 +2130,10 @@ sections:
examples:
- program: '.foo // 42'
input: '{"foo": 19}'
- output: [19]
+ output: ['19']
- program: '.foo // 42'
input: '{}'
- output: [42]
+ output: ['42']
- title: try-catch
body: |
@@ -2306,7 +2303,7 @@ sections:
- program: '[ match("."; "g")] | length'
input: '"abc"'
- output: [3]
+ output: ['3']
- title: "`capture(val)`, `capture(regex; flags)`"
@@ -2330,24 +2327,20 @@ sections:
To capture all the matches for each input string, use the idiom
`[ expr ]`, e.g. `[ scan(regex) ]`.
- example:
+ examples:
- program: 'scan("c")'
input: '"abcdefabc"'
output: ['"c"', '"c"']
- - program: 'scan("b")'
- input: ("", "")
- output: ['[]', '[]']
-
- title: "`split(regex; flags)`"
body: |
For backwards compatibility, `split` splits on a string, not a regex.
- example:
+ examples:
- program: 'split(", *"; null)'
input: '"ab,cd, ef"'
- output: ['"ab","cd","ef"']
+ output: ['["ab","cd","ef"]']
- title: "`splits(regex)`, `splits(regex; flags)`"
@@ -2356,10 +2349,10 @@ sections:
These provide the same results as their `split` counterparts,
but as a stream instead of an array.
- example:
+ examples:
- program: 'splits(", *")'
- input: '("ab,cd", "ef, gh")'
- output: ['"ab"', '"cd"', '"ef"', '"gh"']
+ input: '"ab,cd, ef, gh"'
+ output: ['"ab"','"cd"','"ef"','"gh"']
- title: "`sub(regex; tostring)`, `sub(regex; string; flags)`"
body: |
@@ -2371,10 +2364,10 @@ sections:
constructed by `capture`) to `tostring`, so a reference to a captured
variable named "x" would take the form: `"\(.x)"`.
- example:
- - program: 'sub("^[^a-z]*(?<x>[a-z]*).*")'
- input: '"123abc456"'
- output: '"ZabcZabc"'
+ examples:
+ - program: 'sub("[^a-z]*(?<x>[a-z]+)"; "Z\(.x)"; "g")'
+ input: '"123abc456def"'
+ output: ['"ZabcZdef"']
- title: "`gsub(regex; string)`, `gsub(regex; string; flags)`"
@@ -2383,10 +2376,10 @@ sections:
`gsub` is like `sub` but all the non-overlapping occurrences of the regex are
replaced by the string, after interpolation.
- example:
+ examples:
- program: 'gsub("(?<x>.)[^a]*"; "+\(.x)-")'
input: '"Abcabc"'
- output: '"+A-+a-"'
+ output: ['"+A-+a-"']
- title: Advanced features