1
0
mirror of https://github.com/stedolan/jq.git synced 2024-05-11 05:55:39 +00:00

Copy over changes made to gh-pages directly

This includes the following commits from the gh-pages branch:

 - 63e80b8
 - d24a397
 - 9796cd6
 - ee21707
 - ccb0f1d
 - 200e6b3
 - 64134c0
 - 57152d2
 - 8ffbfa3
This commit is contained in:
David Tolnay
2015-07-23 21:26:18 -07:00
parent f5a7bba986
commit 81f328f1aa
6 changed files with 52 additions and 23 deletions

View File

@@ -150,7 +150,7 @@ body:
- text: | - text: |
For the rest of the examples, I'll leave out the `curl` commandit's not going to change. For the rest of the examples, I'll leave out the `curl` command - it's not going to change.
There's still a lot of info we don't care about there, so we'll There's still a lot of info we don't care about there, so we'll
restrict it down to the most interesting fields. restrict it down to the most interesting fields.
@@ -203,12 +203,12 @@ body:
one at a time, which are all fed into `{message: .commit.message, name: .commit.committer.name}`. one at a time, which are all fed into `{message: .commit.message, name: .commit.committer.name}`.
Data in jq is represented as streams of JSON valuesevery jq Data in jq is represented as streams of JSON values - every jq
expression runs for each value in its input stream, and can expression runs for each value in its input stream, and can
produce any number of values to its output stream. produce any number of values to its output stream.
Streams are serialised by just separating JSON values with Streams are serialised by just separating JSON values with
whitespace. This is a `cat`-friendly formatyou can just join whitespace. This is a `cat`-friendly format - you can just join
two JSON streams together and get a valid JSON stream. two JSON streams together and get a valid JSON stream.
If you want to get the output as a single array, you can tell jq to If you want to get the output as a single array, you can tell jq to

View File

@@ -30,6 +30,9 @@ body:
* jq 1.4 is [in Debian](http://packages.debian.org/jq) * jq 1.4 is [in Debian](http://packages.debian.org/jq)
* jq 1.3.2 is in the official Fedora repository. You can install using
`sudo yum install jq`.
### OS X ### OS X
* `brew install jq` using [homebrew](http://mxcl.github.com/homebrew/) * `brew install jq` using [homebrew](http://mxcl.github.com/homebrew/)
@@ -40,18 +43,23 @@ body:
* Or, grab prebuilt jq 1.3 [64-bit binaries](osx64/jq-1.3/jq) or [32-bit * Or, grab prebuilt jq 1.3 [64-bit binaries](osx64/jq-1.3/jq) or [32-bit
binaries](osx32/jq-1.3/jq) binaries](osx32/jq-1.3/jq)
### Solaris 11 ### Solaris
* jq 1.4 executables for [64-bit](solaris11-64/jq) or [32-bit](solaris11-32/jq) * `pkgutil -i jq` in [OpenCSW](http://www.opencsw.org/p/jq) for Solaris 10+, Sparc and x86
* jq 1.4 executables for Solaris 11 [64-bit](solaris11-64/jq) or [32-bit](solaris11-32/jq)
### Windows ### Windows
* `chocolatey install jq` using [Chocolatey NuGet](https://chocolatey.org/)
* jq 1.4 executables for [64-bit](win64/jq.exe) or [32-bit](win32/jq.exe) * jq 1.4 executables for [64-bit](win64/jq.exe) or [32-bit](win32/jq.exe)
* jq 1.3 executables for [64-bit](win64/jq-1.3/jq.exe) or [32-bit](win32/jq-1.3/jq.exe) * jq 1.3 executables for [64-bit](win64/jq-1.3/jq.exe) or [32-bit](win32/jq-1.3/jq.exe)
### From source on Linux, OS X, Cygwin, and other POSIX-like operating systems ### From source on Linux, OS X, Cygwin, and other POSIX-like operating systems
* [Source tarball for jq $JQ_VERSION](source/jq-$JQ_VERSION.tar.gz) * [Source tarball for jq 1.4](source/jq-1.4.tar.gz)
You can build it using the usual `./configure && make && sudo You can build it using the usual `./configure && make && sudo
make install` rigmarole. make install` rigmarole.

View File

@@ -973,7 +973,7 @@ sections:
input: '[]' input: '[]'
output: ["true"] output: ["true"]
- title: "`flatten`, `flatten(depth)`" - title: "\\[Requires 1.5\\] `flatten`, `flatten(depth)`"
body: | body: |
The filter `flatten` takes as input an array of nested arrays, The filter `flatten` takes as input an array of nested arrays,
@@ -1989,7 +1989,7 @@ sections:
evaluates to: true, true, false, false. evaluates to: true, true, false, false.
entries: entries:
- title: "`test(val)`, `test(regex; flags)`" - title: "\\[Requires 1.5\\] `test(val)`, `test(regex; flags)`"
body: | body: |
Like `match`, but does not return match objects, only `true` or `false` Like `match`, but does not return match objects, only `true` or `false`
@@ -2003,7 +2003,7 @@ sections:
input: '["xabcd", "ABC"]' input: '["xabcd", "ABC"]'
output: ['true', 'true'] output: ['true', 'true']
- title: "`match(val)`, `match(regex; flags)`" - title: "\\[Requires 1.5\\] `match(val)`, `match(regex; flags)`"
body: | body: |
**match** outputs an object for each match it finds. Matches have **match** outputs an object for each match it finds. Matches have
@@ -2048,7 +2048,7 @@ sections:
output: [3] output: [3]
- title: "`capture(val)`, `capture(regex; flags)`" - title: "\\[Requires 1.5\\] `capture(val)`, `capture(regex; flags)`"
body: | body: |
Collects the named captures in a JSON object, with the name Collects the named captures in a JSON object, with the name
@@ -2060,7 +2060,7 @@ sections:
input: '"xyzzy-14"' input: '"xyzzy-14"'
output: ['{ "a": "xyzzy", "n": "14" }'] output: ['{ "a": "xyzzy", "n": "14" }']
- title: "`scan(regex)`, `scan(regex; flags)`" - title: "\\[Requires 1.5\\] `scan(regex)`, `scan(regex; flags)`"
body: | body: |
Emit a stream of the non-overlapping substrings of the input Emit a stream of the non-overlapping substrings of the input
@@ -2089,7 +2089,7 @@ sections:
output: ['"ab","cd","ef"'] output: ['"ab","cd","ef"']
- title: "`splits(regex)`, `splits(regex; flags)`" - title: "\\[Requires 1.5\\] `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,
@@ -2100,7 +2100,7 @@ sections:
input: '("ab,cd", "ef, gh")' input: '("ab,cd", "ef, gh")'
output: ['"ab"', '"cd"', '"ef"', '"gh"'] output: ['"ab"', '"cd"', '"ef"', '"gh"']
- title: "`sub(regex; tostring)` `sub(regex; string; flags)`" - title: "\\[Requires 1.5\\] `sub(regex; tostring)` `sub(regex; string; flags)`"
body: | body: |
Emit the string obtained by replacing the first match of regex in the Emit the string obtained by replacing the first match of regex in the
@@ -2116,7 +2116,7 @@ sections:
output: '"ZabcZabc"' output: '"ZabcZabc"'
- title: "`gsub(regex; string)`, `gsub(regex; string; flags)`" - title: "\\[Requires 1.5\\] `gsub(regex; string)`, `gsub(regex; string; flags)`"
body: | body: |
`gsub` is like `sub` but all the non-overlapping occurrences of the regex are `gsub` is like `sub` but all the non-overlapping occurrences of the regex are

View File

@@ -2,8 +2,7 @@ headline: jq
blurb: | blurb: |
jq is a lightweight and flexible command-line JSON processor with jq is a lightweight and flexible command-line JSON processor.
support for regular expressions.
body1: | body1: |
@@ -24,10 +23,21 @@ body3: |
shorter and simpler than you'd expect. shorter and simpler than you'd expect.
tail: | tail: |
Go read the [tutorial](tutorial/) for more, or the [manual](manual/) Go read the [tutorial](tutorial/) for more, or the [manual](manual/)
for *way* more. for *way* more. Ask questions over on
[stackoverflow](http://stackoverflow.com/) using the [jq
tag](http://stackoverflow.com/questions/tagged/jq), or on the
[#jq](http://irc.lc/freenode/%23jq/) channel over on
[Freenode](https://webchat.freenode.net/).
news: news:
- date: 2015-01-01
body: |
jq 1.5rc1 Get it on the
[releases](https://github.com/stedolan/jq/releases) page.
- date: 2014-06-08 - date: 2014-06-08
body: | body: |

View File

@@ -27,7 +27,7 @@
<div class="btn-group" style="float:right"> <div class="btn-group" style="float:right">
<a class="btn btn-primary" href="http://jqplay.org"> <a class="btn btn-primary" href="http://jqplay.org">
Try online! Try online at jqplay.org!
</a> </a>
</div> </div>

View File

@@ -35,6 +35,17 @@
} }
}); });
}); });
// add "Run" button to execute examples on jqplay.org
$(function() {
$.each($('table.manual-example'), function(index, value) {
$value = $(value)
var j = $value.find('tr:nth-child(2) td:first').text();
var q = $value.find('.jqprogram').text().replace(/^jq /, '').replace(/^'(.+)'$/, '$1');
var url = 'https://jqplay.org/jq?q=' + encodeURIComponent(q) +'&j=' + encodeURIComponent(j)
var $last_tr = $value.find('tr:last');
$last_tr.after('<tr><th><a href="' + url + '" class="btn btn-primary btn-small">Run</a></th><th></th></tr><tr><th></th><th></th></tr>');
});
});
</script> </script>
<input type="text" <input type="text"
class="input-medium search-query" class="input-medium search-query"