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: |
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
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}`.
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
produce any number of values to its output stream.
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.
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.3.2 is in the official Fedora repository. You can install using
`sudo yum install jq`.
### OS X
* `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
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
* `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.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
* [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
make install` rigmarole.

View File

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

View File

@@ -1,10 +1,9 @@
headline: jq
blurb: |
jq is a lightweight and flexible command-line JSON processor with
support for regular expressions.
jq is a lightweight and flexible command-line JSON processor.
body1: |
jq is like `sed` for JSON data - you can use it to slice and filter
@@ -22,19 +21,30 @@ body3: |
jq can mangle the data format that you have into the one that you
want with very little effort, and the program to do so is often
shorter and simpler than you'd expect.
tail: |
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:
- date: 2015-01-01
body: |
jq 1.5rc1 Get it on the
[releases](https://github.com/stedolan/jq/releases) page.
- date: 2014-06-08
body: |
jq 1.4 (finally) released! Get it on the [download](download/) page.
- date: 2013-05-19
body: |
jq 1.3 released.

View File

@@ -27,7 +27,7 @@
<div class="btn-group" style="float:right">
<a class="btn btn-primary" href="http://jqplay.org">
Try online!
Try online at jqplay.org!
</a>
</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>
<input type="text"
class="input-medium search-query"