pandoc-lua-marshal-0.1.7: Use pandoc types in Lua
Copyright© 2021-2022 Albert Krewinkel
LicenseMIT
MaintainerAlbert Krewinkel <tarleb+pandoc@moltkeplatz.de>
Safe HaskellNone
LanguageHaskell2010

Text.Pandoc.Lua.Marshal.Filter

Description

Marshaling/unmarshaling functions Lua filters, i.e., tables containing functions to be called on specific elements.

Synopsis

Filters

data Filter Source #

Collection of filter functions (at most one function per element constructor)

data WalkingOrder Source #

Description of how an AST should be traversed.

Constructors

WalkForEachType

Process each type separately, traversing the tree bottom-up (leaves to root) for each type.

WalkTopdown

Traverse the tree top-down, from root to leaves and depth first, in a single traversal.

peekFilter :: LuaError e => Peeker e Filter Source #

Retrieves a default Filter object from the stack, suitable for filtering a full document.

lookup :: Name -> Filter -> Maybe FilterFunction Source #

Looks up a filter function in a Lua Filter.

member :: Name -> Filter -> Bool Source #

Checks whether the Filter contains a function of the given name.

Individual filter functions

newtype FilterFunction Source #

Filter function stored in the registry

peekFilterFunction :: Peeker e FilterFunction Source #

Retrieves a filter function from the stack.

The value at the given index must be a function. It is stored in the Lua registry.

pushFilterFunction :: LuaError e => FilterFunction -> LuaE e () Source #

Pushes a filter function to the stack.

Filter functions are stored in the registry and retrieved from there.

getFunctionFor :: forall a. Data a => Filter -> a -> Maybe FilterFunction Source #

Finds the best filter function for a given element; returns Nothing if no such function exists.

Names in filter functions

baseFunctionName :: forall a. Data a => Proxy a -> Name Source #

The name of a type's base function, which is called if there is no more specific function for a value.

listFunctionName :: forall a. Data a => Proxy a -> Name Source #

The name of the functions that's called on lists of the given type.

valueFunctionNames :: forall a. Data a => Proxy a -> [Name] Source #

Filter function names for a given type.