touying-reduce
touying-reduce(package, bindings: (reduce: none, cover: none), ..args)(source)Automatically reduces the content with the given package and given or predefined bindings. Only works if the package exposes the bindings or its name and touying defines the bindings for the name.
Usage:
#touying-reduce(cetz, {
import cetz.draw: *
rect((0,0), (5,5))
(pause,)
rect((0,0), (1,1))
rect((1,1), (2,2))
rect((2,2), (3,3))
(pause,)
line((0,0), (2.5, 2.5), name: "line")
})
package : module
The external package to integrate with touying. It should expose its name for auto-binding to work (e.g. cetz).
bindings : dictionary default: (reduce: none, cover: none)
Optional explicit bindings for the reduce and cover functions. Should be a dictionary with keys reduce and cover, where each value is a closure taking in the module and returning the function you need: e.g. mod=>mod.hide. If any fields are none, it uses the package's own touying-reducer-bindings when they are usable (a dictionary whose reduce and cover are functions), and otherwise the predefined bindings in extern.auto-reducer-bindings for the package's name.
..args : arguments
The positional and named arguments passed to the reduce function.
Returns: content