Merge pull request #651 from eiiches/fix-examples

Fix several errors in the manual
This commit is contained in:
Nico Williams committed 2014-12-24 11:29:29 -06:00
commit e0f9b6a5cd
2 files changed
+12 -12

No files matched your search

+9 -9
View File
@@ -1094,7 +1094,7 @@ sections:
output: ['[{"foo": 1, "bar": 2}, {"foo": 4, "bar": 5}]'] output: ['[{"foo": 1, "bar": 2}, {"foo": 4, "bar": 5}]']
- program: 'unique_by(length)' - program: 'unique_by(length)'
input: '["chunky", "bacon", "kitten", "cicada", "asparagus"]' input: '["chunky", "bacon", "kitten", "cicada", "asparagus"]'
output: ['["chunky", "bacon", "asparagus"]'] output: ['["bacon", "chunky", "asparagus"]']
- title: "`reverse`" - title: "`reverse`"
body: | body: |
@@ -1164,7 +1164,7 @@ sections:
- program: 'index(", ")' - program: 'index(", ")'
input: '"a,b, cd, efg, hijk"' input: '"a,b, cd, efg, hijk"'
output: ['3'] output: ['3']
- program: 'rindex(", ")]' - program: 'rindex(", ")'
input: '"a,b, cd, efg, hijk"' input: '"a,b, cd, efg, hijk"'
output: ['12'] output: ['12']
@@ -1343,6 +1343,7 @@ sections:
- program: 'recurse' - program: 'recurse'
input: '{"a":0,"b":[1]}' input: '{"a":0,"b":[1]}'
output: output:
- '{"a":0,"b":[1]}'
- '0' - '0'
- '[1]' - '[1]'
- '1' - '1'
@@ -1709,11 +1710,10 @@ sections:
examples: examples:
- program: 'test("foo")' - program: 'test("foo")'
input: '"foo"' input: '"foo"'
output: 'true' output: ['true']
- program: 'test("a b c # spaces are ignored"; "ix")' - program: '.[] | test("a b c # spaces are ignored"; "ix")'
input: '"xabcd" "ABC"' input: '["xabcd", "ABC"]'
output: true output: ['true', 'true']
true
- title: "`match(val)`, `match(regex; flags)`" - title: "`match(val)`, `match(regex; flags)`"
body: | body: |
@@ -1757,7 +1757,7 @@ sections:
- program: '[ match("."; "g")] | length' - program: '[ match("."; "g")] | length'
input: '"abc"' input: '"abc"'
output: 3 output: [3]
- title: "`capture(val)`, `capture(regex; flags)`" - title: "`capture(val)`, `capture(regex; flags)`"
@@ -1806,7 +1806,7 @@ sections:
output: ['"ab","cd","ef"'] output: ['"ab","cd","ef"']
- title: "`splits(regex)`, splits(regex; flags)`" - title: "`splits(regex)`, `splits(regex; flags)`"
body: | body: |
These provide the same results as their `split` counterparts, These provide the same results as their `split` counterparts,
+3 -3
View File
@@ -70,8 +70,8 @@
{% for example in entry.examples %} {% for example in entry.examples %}
<table class="manual-example"> <table class="manual-example">
<tr><th></th><td class="jqprogram">jq '{{example.program}}'</td></tr> <tr><th></th><td class="jqprogram">jq '{{example.program | escape}}'</td></tr>
<tr><th>Input</th><td>{{example.input}}</td></tr> <tr><th>Input</th><td>{{example.input | escape}}</td></tr>
{% unless example.output[0] %} {% unless example.output[0] %}
<tr> <tr>
<th>Output</th> <th>Output</th>
@@ -85,7 +85,7 @@
{% else %} {% else %}
<th></th> <th></th>
{% endif %} {% endif %}
<td>{{output}}</td> <td>{{output | escape}}</td>
</tr> </tr>
{% endfor %} {% endfor %}