Skip to main content

touying-reduce

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")
})
Parameters

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 the values are paths (as arrays of strings) with an optionally last entry being arguments to pass to the function. If any fields are none, it checks whether the package has touying-reducer-bindings otherwise touying will look up predefined bindings in extern.auto-reducer-bindings based on the package name.

..args : arguments

The positional and named arguments passed to the reduce function.

Returns: content