Skip to content
Myr

Escape some code parts in manual. (#3184)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Michael Färber · committed by GitHub · parent d8463c2 · Browse files · 3 files+30 added−30 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

3 files+30 added−30 removed

  • other:+30 added−30 removed

3 files+30 added−30 removed

modified:docs/content/manual/dev/manual.yml+10 added-10 removed
1009 unmodified lines
1010 at all.10111012 The key difference between `map(f)` and `map_values(f)` is1013 that the former simply forms an array from all the values of1014 `($x|f)` for each value, $x, in the input array or object,1014 `($x|f)` for each value, `$x`, in the input array or object,1015 but `map_values(f)` only uses `first($x|f)`.10161017 Specifically, for object inputs, `map_values(f)` constructs1018 the output object by examining in turn the value of1019 `first(.[$k]|f)` for each key, $k, of the input. If this1019 `first(.[$k]|f)` for each key, `$k`, of the input. If this1020 expression produces no values, then the corresponding key1021 will be dropped; otherwise, the output object will have that1022 value at the key, $k.1022 value at the key, `$k`.10231024 Here are some examples to clarify the behavior of `map` and1025 `map_values` when applied to arrays. These examples assume the1026 input is `[1]` in all cases:
1264 unmodified lines
2291 body: |22922293 jq provides a few SQL-style operators.22942295 * INDEX(stream; index_expression):2295 * `INDEX(stream; index_expression)`:22962297 This builtin produces an object whose keys are computed by2298 the given index expression applied to each value from the2299 given stream.23002301 * JOIN($idx; stream; idx_expr; join_expr):2301 * `JOIN($idx; stream; idx_expr; join_expr)`:23022303 This builtin joins the values from the given stream to the2304 given index. The index's keys are computed by applying the2305 given index expression to each value from the given stream.2306 An array of the value in the stream and the corresponding2307 value from the index is fed to the given join expression to2308 produce each result.23092310 * JOIN($idx; stream; idx_expr):2310 * `JOIN($idx; stream; idx_expr)`:23112312 Same as `JOIN($idx; stream; idx_expr; .)`.23132314 * JOIN($idx; idx_expr):2314 * `JOIN($idx; idx_expr)`:23152316 This builtin joins the input `.` to the given index, applying2317 the given index expression to `.` to compute the index key.2318 The join operation is as described above.23192320 * IN(s):2320 * `IN(s)`:23212322 This builtin outputs `true` if `.` appears in the given2323 stream, otherwise it outputs `false`.23242325 * IN(source; s):2325 * `IN(source; s)`:23262327 This builtin outputs `true` if any value in the source stream2328 appears in the second stream, otherwise it outputs `false`.2329
513 unmodified lines
28432844 {"title": "First post", "author": "Anonymous Coward"}2845 {"title": "A well-written article", "author": "Person McPherson"}28462847 We use a variable, $names, to store the realnames object, so that we2847 We use a variable, `$names`, to store the realnames object, so that we2848 can refer to it later when looking up author usernames:28492850 .realnames as $names | .posts[] | {title, author: $names[.author]}2851
976 unmodified lines
modified:docs/content/manual/v1.7/manual.yml+10 added-10 removed
997 unmodified lines
998 at all.9991000 The key difference between `map(f)` and `map_values(f)` is1001 that the former simply forms an array from all the values of1002 `($x|f)` for each value, $x, in the input array or object,1002 `($x|f)` for each value, `$x`, in the input array or object,1003 but `map_values(f)` only uses `first($x|f)`.10041005 Specifically, for object inputs, `map_values(f)` constructs1006 the output object by examining in turn the value of1007 `first(.[$k]|f)` for each key, $k, of the input. If this1007 `first(.[$k]|f)` for each key, `$k`, of the input. If this1008 expression produces no values, then the corresponding key1009 will be dropped; otherwise, the output object will have that1010 value at the key, $k.1010 value at the key, `$k`.10111012 Here are some examples to clarify the behavior of `map` and1013 `map_values` when applied to arrays. These examples assume the1014 input is `[1]` in all cases:
1223 unmodified lines
2238 body: |22392240 jq provides a few SQL-style operators.22412242 * INDEX(stream; index_expression):2242 * `INDEX(stream; index_expression)`:22432244 This builtin produces an object whose keys are computed by2245 the given index expression applied to each value from the2246 given stream.22472248 * JOIN($idx; stream; idx_expr; join_expr):2248 * `JOIN($idx; stream; idx_expr; join_expr)`:22492250 This builtin joins the values from the given stream to the2251 given index. The index's keys are computed by applying the2252 given index expression to each value from the given stream.2253 An array of the value in the stream and the corresponding2254 value from the index is fed to the given join expression to2255 produce each result.22562257 * JOIN($idx; stream; idx_expr):2257 * `JOIN($idx; stream; idx_expr)`:22582259 Same as `JOIN($idx; stream; idx_expr; .)`.22602261 * JOIN($idx; idx_expr):2261 * `JOIN($idx; idx_expr)`:22622263 This builtin joins the input `.` to the given index, applying2264 the given index expression to `.` to compute the index key.2265 The join operation is as described above.22662267 * IN(s):2267 * `IN(s)`:22682269 This builtin outputs `true` if `.` appears in the given2270 stream, otherwise it outputs `false`.22712272 * IN(source; s):2272 * `IN(source; s)`:22732274 This builtin outputs `true` if any value in the source stream2275 appears in the second stream, otherwise it outputs `false`.2276
511 unmodified lines
27882789 {"title": "First post", "author": "Anonymous Coward"}2790 {"title": "A well-written article", "author": "Person McPherson"}27912792 We use a variable, $names, to store the realnames object, so that we2792 We use a variable, `$names`, to store the realnames object, so that we2793 can refer to it later when looking up author usernames:27942795 .realnames as $names | .posts[] | {title, author: $names[.author]}2796
901 unmodified lines
modified:jq.1.prebuilt+10 added-10 removed
1.2.TH "JQ" "1" "November 2024" "" ""2.TH "JQ" "1" "January 2025" "" ""3.4.SH "NAME"5\fBjq\fR \- Command\-line JSON processor6.
999 unmodified lines
1006.P1007When the input to \fBmap_values(f)\fR is an object, the output object has the same keys as the input object except for those keys whose values when piped to \fBf\fR produce no values at all\.1008.1009.P1010The key difference between \fBmap(f)\fR and \fBmap_values(f)\fR is that the former simply forms an array from all the values of \fB($x|f)\fR for each value, $x, in the input array or object, but \fBmap_values(f)\fR only uses \fBfirst($x|f)\fR\.1010The key difference between \fBmap(f)\fR and \fBmap_values(f)\fR is that the former simply forms an array from all the values of \fB($x|f)\fR for each value, \fB$x\fR, in the input array or object, but \fBmap_values(f)\fR only uses \fBfirst($x|f)\fR\.1011.1012.P1013Specifically, for object inputs, \fBmap_values(f)\fR constructs the output object by examining in turn the value of \fBfirst(\.[$k]|f)\fR for each key, $k, of the input\. If this expression produces no values, then the corresponding key will be dropped; otherwise, the output object will have that value at the key, $k\.1013Specifically, for object inputs, \fBmap_values(f)\fR constructs the output object by examining in turn the value of \fBfirst(\.[$k]|f)\fR for each key, \fB$k\fR, of the input\. If this expression produces no values, then the corresponding key will be dropped; otherwise, the output object will have that value at the key, \fB$k\fR\.1014.1015.P1016Here are some examples to clarify the behavior of \fBmap\fR and \fBmap_values\fR when applied to arrays\. These examples assume the input is \fB[1]\fR in all cases:1017.
1462 unmodified lines
2480.SS "SQL\-Style Operators"2481jq provides a few SQL\-style operators\.2482.2483.TP2484INDEX(stream; index_expression):2484\fBINDEX(stream; index_expression)\fR:2485.2486.IP2487This builtin produces an object whose keys are computed by the given index expression applied to each value from the given stream\.2488.2489.TP2490JOIN($idx; stream; idx_expr; join_expr):2490\fBJOIN($idx; stream; idx_expr; join_expr)\fR:2491.2492.IP2493This builtin joins the values from the given stream to the given index\. The index\'s keys are computed by applying the given index expression to each value from the given stream\. An array of the value in the stream and the corresponding value from the index is fed to the given join expression to produce each result\.2494.2495.TP2496JOIN($idx; stream; idx_expr):2496\fBJOIN($idx; stream; idx_expr)\fR:2497.2498.IP2499Same as \fBJOIN($idx; stream; idx_expr; \.)\fR\.2500.2501.TP2502JOIN($idx; idx_expr):2502\fBJOIN($idx; idx_expr)\fR:2503.2504.IP2505This builtin joins the input \fB\.\fR to the given index, applying the given index expression to \fB\.\fR to compute the index key\. The join operation is as described above\.2506.2507.TP2508IN(s):2508\fBIN(s)\fR:2509.2510.IP2511This builtin outputs \fBtrue\fR if \fB\.\fR appears in the given stream, otherwise it outputs \fBfalse\fR\.2512.2513.TP2514IN(source; s):2514\fBIN(source; s)\fR:2515.2516.IP2517This builtin outputs \fBtrue\fR if any value in the source stream appears in the second stream, otherwise it outputs \fBfalse\fR\.2518.
624 unmodified lines
3143.3144.IP "" 03145.3146.P3147We use a variable, $names, to store the realnames object, so that we can refer to it later when looking up author usernames:3147We use a variable, \fB$names\fR, to store the realnames object, so that we can refer to it later when looking up author usernames:3148.3149.IP "" 43150.3151.nf
1116 unmodified lines