Skip to content

Commit

Permalink
Fix manual source code to follow the schema definition
Browse files Browse the repository at this point in the history
  • Loading branch information
itchyny authored and nicowilliams committed Jul 23, 2023
1 parent 9044f54 commit 34629ed
Show file tree
Hide file tree
Showing 5 changed files with 108 additions and 125 deletions.
41 changes: 19 additions & 22 deletions docs/content/manual/manual.yml
Original file line number Diff line number Diff line change
Expand Up @@ -404,15 +404,15 @@ 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: |
Expand All @@ -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: ['[]']
Expand Down Expand Up @@ -583,7 +583,7 @@ sections:
examples:
- program: '(. + 2) * 5'
input: '1'
output: [15]
output: ['15']

- title: Types and Values
body: |
Expand Down Expand Up @@ -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"]']
Expand Down Expand Up @@ -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`"
Expand All @@ -873,7 +873,7 @@ sections:
examples:
- program: 'utf8bytelength'
input: '"\u03bc"'
output: [2]
output: ['2']

- title: "`keys`, `keys_unsorted`"
body: |
Expand Down Expand Up @@ -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]']
Expand Down Expand Up @@ -1253,7 +1253,7 @@ sections:
output: ['"abc"']
- program: add
input: '[1, 2, 3]'
output: [6]
output: ['6']
- program: add
input: '[]'
output: ["null"]
Expand Down Expand Up @@ -1402,7 +1402,7 @@ sections:
examples:
- program: '.[] | tonumber'
input: '[1, "1"]'
output: [1, 1]
output: ['1', '1']

- title: "`tostring`"
body: |
Expand Down Expand Up @@ -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: |
Expand Down Expand Up @@ -2258,7 +2255,7 @@ sections:
else
"many"
end
input: 2
input: '2'
output: ['"many"']
- title: "`>`, `>=`, `<=`, `<`"
Expand All @@ -2273,7 +2270,7 @@ sections:
examples:
- program: '. < 5'
input: 2
input: '2'
output: ['true']

- title: "`and`, `or`, `not`"
Expand Down Expand Up @@ -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: |
Expand Down Expand Up @@ -2510,7 +2507,7 @@ sections:

- program: '[ match("."; "g")] | length'
input: '"abc"'
output: [3]
output: ['3']


- title: "`capture(val)`, `capture(regex; flags)`"
Expand Down
22 changes: 11 additions & 11 deletions docs/content/manual/v1.3/manual.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand Down Expand Up @@ -438,8 +438,8 @@ sections:
examples:
- program: '10 / . * 3'
input: 5
output: [6]
input: '5'
output: ['6']

- title: '`length`'
body: |
Expand All @@ -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: |
Expand Down Expand Up @@ -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]']
Expand Down Expand Up @@ -591,7 +591,7 @@ sections:
output: ['"abc"']
- program: add
input: '[1, 2, 3]'
output: [6]
output: ['6']
- program: add
input: '[]'
output: ["null"]
Expand Down Expand Up @@ -622,7 +622,7 @@ sections:
examples:
- program: '.[] | tonumber'
input: '[1, "1"]'
output: [1, 1]
output: ['1', '1']

- title: '`tostring`'
body: |
Expand Down Expand Up @@ -925,7 +925,7 @@ sections:
else
"many"
end
input: 2
input: '2'
output: ['"many"']
- title: "`>`, `>=`, `<=`, `<`"
Expand All @@ -940,7 +940,7 @@ sections:
examples:
- program: '. < 5'
input: 2
input: '2'
output: ['true']

- title: "`and`, `or`, `not`"
Expand Down Expand Up @@ -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: |
Expand Down
28 changes: 14 additions & 14 deletions docs/content/manual/v1.4/manual.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand All @@ -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: ['[]']
Expand Down Expand Up @@ -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"]']
Expand All @@ -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: |
Expand Down Expand Up @@ -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]']
Expand Down Expand Up @@ -758,7 +758,7 @@ sections:
output: ['"abc"']
- program: add
input: '[1, 2, 3]'
output: [6]
output: ['6']
- program: add
input: '[]'
output: ["null"]
Expand Down Expand Up @@ -849,7 +849,7 @@ sections:
examples:
- program: '.[] | tonumber'
input: '[1, "1"]'
output: [1, 1]
output: ['1', '1']

- title: "`tostring`"
body: |
Expand Down Expand Up @@ -1327,7 +1327,7 @@ sections:
else
"many"
end
input: 2
input: '2'
output: ['"many"']
- title: "`>`, `>=`, `<=`, `<`"
Expand All @@ -1342,7 +1342,7 @@ sections:
examples:
- program: '. < 5'
input: 2
input: '2'
output: ['true']

- title: "`and`, `or`, `not`"
Expand Down Expand Up @@ -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: |
Expand Down
Loading

0 comments on commit 34629ed

Please sign in to comment.