Skip to content

Commit 2be3fd8

Browse files
committed
fix several doc syntaxes and add more refs
1 parent 0cf0f7c commit 2be3fd8

File tree

3 files changed

+21
-9
lines changed

3 files changed

+21
-9
lines changed

docs/src/utilities.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ such as `x::Int=2` and returns `(arg_name, arg_type, slurp, default)`. `default`
6767
## Other Utilities
6868

6969
```@docs
70+
MacroTools.@q
7071
MacroTools.isexpr
7172
MacroTools.rmlines
7273
MacroTools.unblock

src/examples/threading.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ The threading macro is like a more flexible version of the `|>` operator.
55
@> x g f == f(g(x))
66
@> x a b c d e == e(d(c(b(a(x)))))
77
8-
Unlike |>, functions can have arguments - the value
8+
Unlike `|>`, functions can have arguments - the value
99
preceding a function will be treated as its first argument
1010
1111
@> x g(y, z) f == f(g(x, y, z))
1212
1313
@> x g f(y, z) == f(g(x), y, z)
1414
15-
See also `@>>`, `@as`.
15+
See also [`@>>`](@ref), [`@as`](@ref).
1616
"""
1717
macro >(exs...)
1818
thread(x) = isexpr(x, :block) ? thread(rmlines(x).args...) : x
@@ -28,7 +28,7 @@ macro >(exs...)
2828
end
2929

3030
"""
31-
Same as `@>`, but threads the last argument.
31+
Same as [`@>`](@ref), but threads the last argument.
3232
3333
@>> x g(y, z) f == f(g(y, z, x))
3434

src/utils.jl

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ end
2626
Like the `quote` keyword but doesn't insert line numbers from the construction
2727
site. e.g. compare `@q begin end` with `quote end`. Line numbers of interpolated
2828
expressions are preserverd.
29+
30+
See also: [`rmlines`](@ref)
2931
"""
3032
macro q(ex)
3133
Expr(:quote, striplines(ex))
@@ -65,6 +67,8 @@ To work with nested blocks:
6567
```julia
6668
prewalk(rmlines, ex)
6769
```
70+
71+
See also: [`@q`](@ref)
6872
"""
6973
rmlines(x) = x
7074
function rmlines(x::Expr)
@@ -108,8 +112,9 @@ walk(x::Expr, inner, outer) = outer(Expr(x.head, map(inner, x.args)...))
108112
postwalk(f, expr)
109113
110114
Applies `f` to each node in the given expression tree, returning the result.
111-
`f` sees expressions *after* they have been transformed by the walk. See also
112-
`prewalk`.
115+
`f` sees expressions *after* they have been transformed by the walk.
116+
117+
See also: [`prewalk`](@ref).
113118
"""
114119
postwalk(f, x) = walk(x, x -> postwalk(f, x), f)
115120

@@ -121,7 +126,7 @@ Applies `f` to each node in the given expression tree, returning the result.
121126
walk will be applied to whatever `f` returns.
122127
123128
This makes `prewalk` somewhat prone to infinite loops; you probably want to try
124-
`postwalk` first.
129+
[`postwalk`](@ref) first.
125130
"""
126131
prewalk(f, x) = walk(f(x), x -> prewalk(f, x), identity)
127132

@@ -282,6 +287,8 @@ all_params = [get(dict, :params, [])..., get(dict, :whereparams, [])...]
282287
\$(dict[:body])
283288
end)
284289
```
290+
291+
See also: [`combinedef`](@ref)
285292
"""
286293
function splitdef(fdef)
287294
error_msg = "Not a function definition: $(repr(fdef))"
@@ -306,8 +313,9 @@ end
306313
"""
307314
combinedef(dict::Dict)
308315
309-
`combinedef` is the inverse of `splitdef`. It takes a splitdef-like Dict
310-
and returns a function definition. """
316+
`combinedef` is the inverse of [`splitdef`](@ref). It takes a `splitdef`-like Dict
317+
and returns a function definition.
318+
"""
311319
function combinedef(dict::Dict)
312320
rtype = get(dict, :rtype, nothing)
313321
params = get(dict, :params, [])
@@ -347,7 +355,8 @@ end
347355
"""
348356
combinearg(arg_name, arg_type, is_splat, default)
349357
350-
`combinearg` is the inverse of `splitarg`. """
358+
`combinearg` is the inverse of [`splitarg`](@ref).
359+
"""
351360
function combinearg(arg_name, arg_type, is_splat, default)
352361
a = arg_name===nothing ? :(::$arg_type) : :($arg_name::$arg_type)
353362
a2 = is_splat ? Expr(:..., a) : a
@@ -376,6 +385,8 @@ Match function arguments (whether from a definition or a function call) such as
376385
(:y, :Any, false, nothing)
377386
(:args, :Any, true, nothing)
378387
```
388+
389+
See also: [`combinearg`](@ref)
379390
"""
380391
function splitarg(arg_expr)
381392
splitvar(arg) =

0 commit comments

Comments
 (0)