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
Provenance
- Commit
18bd837- Tree
3d3c964- Author
Michael Färber <01mf02@gmail.com>- Committer
GitHub <noreply@github.com>- Parent
d8463c2
3 files changed+30 added−30 removed
modified:docs/content/manual/dev/manual.yml+10 added-10 removed
1009 unmodified lines1010 at all.1011 1012 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)`.1016 1017 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`.1023 1024 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 lines2291 body: |2292 2293 jq provides a few SQL-style operators.2294 2295- * INDEX(stream; index_expression):2295+ * `INDEX(stream; index_expression)`:2296 2297 This builtin produces an object whose keys are computed by2298 the given index expression applied to each value from the2299 given stream.2300 2301- * JOIN($idx; stream; idx_expr; join_expr):2301+ * `JOIN($idx; stream; idx_expr; join_expr)`:2302 2303 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.2309 2310- * JOIN($idx; stream; idx_expr):2310+ * `JOIN($idx; stream; idx_expr)`:2311 2312 Same as `JOIN($idx; stream; idx_expr; .)`.2313 2314- * JOIN($idx; idx_expr):2314+ * `JOIN($idx; idx_expr)`:2315 2316 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.2319 2320- * IN(s):2320+ * `IN(s)`:2321 2322 This builtin outputs `true` if `.` appears in the given2323 stream, otherwise it outputs `false`.2324 2325- * IN(source; s):2325+ * `IN(source; s)`:2326 2327 This builtin outputs `true` if any value in the source stream2328 appears in the second stream, otherwise it outputs `false`.2329 513 unmodified lines2843 2844 {"title": "First post", "author": "Anonymous Coward"}2845 {"title": "A well-written article", "author": "Person McPherson"}2846 2847- 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:2849 2850 .realnames as $names | .posts[] | {title, author: $names[.author]}2851 976 unmodified linesmodified:docs/content/manual/v1.7/manual.yml+10 added-10 removed
997 unmodified lines998 at all.999 1000 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)`.1004 1005 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`.1011 1012 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 lines2238 body: |2239 2240 jq provides a few SQL-style operators.2241 2242- * INDEX(stream; index_expression):2242+ * `INDEX(stream; index_expression)`:2243 2244 This builtin produces an object whose keys are computed by2245 the given index expression applied to each value from the2246 given stream.2247 2248- * JOIN($idx; stream; idx_expr; join_expr):2248+ * `JOIN($idx; stream; idx_expr; join_expr)`:2249 2250 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.2256 2257- * JOIN($idx; stream; idx_expr):2257+ * `JOIN($idx; stream; idx_expr)`:2258 2259 Same as `JOIN($idx; stream; idx_expr; .)`.2260 2261- * JOIN($idx; idx_expr):2261+ * `JOIN($idx; idx_expr)`:2262 2263 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.2266 2267- * IN(s):2267+ * `IN(s)`:2268 2269 This builtin outputs `true` if `.` appears in the given2270 stream, otherwise it outputs `false`.2271 2272- * IN(source; s):2272+ * `IN(source; s)`:2273 2274 This builtin outputs `true` if any value in the source stream2275 appears in the second stream, otherwise it outputs `false`.2276 511 unmodified lines2788 2789 {"title": "First post", "author": "Anonymous Coward"}2790 {"title": "A well-written article", "author": "Person McPherson"}2791 2792- 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:2794 2795 .realnames as $names | .posts[] | {title, author: $names[.author]}2796 901 unmodified linesmodified: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 lines1006 .P1007 When 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 .P1010-The 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\.1010+The 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 .P1013-Specifically, 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\.1013+Specifically, 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 .P1016 Here 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 lines2480 .SS "SQL\-Style Operators"2481 jq provides a few SQL\-style operators\.2482 .2483 .TP2484-INDEX(stream; index_expression):2484+\fBINDEX(stream; index_expression)\fR:2485 .2486 .IP2487 This builtin produces an object whose keys are computed by the given index expression applied to each value from the given stream\.2488 .2489 .TP2490-JOIN($idx; stream; idx_expr; join_expr):2490+\fBJOIN($idx; stream; idx_expr; join_expr)\fR:2491 .2492 .IP2493 This 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 .TP2496-JOIN($idx; stream; idx_expr):2496+\fBJOIN($idx; stream; idx_expr)\fR:2497 .2498 .IP2499 Same as \fBJOIN($idx; stream; idx_expr; \.)\fR\.2500 .2501 .TP2502-JOIN($idx; idx_expr):2502+\fBJOIN($idx; idx_expr)\fR:2503 .2504 .IP2505 This 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 .TP2508-IN(s):2508+\fBIN(s)\fR:2509 .2510 .IP2511 This builtin outputs \fBtrue\fR if \fB\.\fR appears in the given stream, otherwise it outputs \fBfalse\fR\.2512 .2513 .TP2514-IN(source; s):2514+\fBIN(source; s)\fR:2515 .2516 .IP2517 This builtin outputs \fBtrue\fR if any value in the source stream appears in the second stream, otherwise it outputs \fBfalse\fR\.2518 .624 unmodified lines3143 .3144 .IP "" 03145 .3146 .P3147-We use a variable, $names, to store the realnames object, so that we can refer to it later when looking up author usernames:3147+We 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 .nf1116 unmodified lines