Interfaces classes

SILE document class interface.

Functions

class:registerPostinit(func[, options]) Register a callback function to be executed after the class initialization has completed.
class.registerCommand(name, func[, help[, pack]]) Register a function as a SILE command.


Functions

class:registerPostinit(func[, options])
Register a callback function to be executed after the class initialization has completed. Sometimes a class or package may want to run things after the class has been fully initialized. This can be useful for setting document settings after packages and all their dependencies have been loaded. For example a package might want to trigger something to happen after all frames have been defined, but the package itself doesn't know if it is being loaded before or after the document options are processed, frame masters have been setup, etc. Rather than relying on the user to load the package after these events, the package can use this callback to defer the action until those things can be reasonable expected to have completed.

Functions in the deferred initialization queue are run on a first-set first-run basis.

Note the typesetter will not have been instantiated yet, so is not appropriate to try to output content at this point. Injecting content to be processed at the start of a document should be done with preambles. The inputter will be instantiated at this point, so adding a new preamble is viable. If the class has already been initialized the callback function will be run immediately.

Parameters:

  • func function Callback function accepting up to two arguments.
  • options table Additional table passed as a second argument to the callback. (optional)
class.registerCommand(name, func[, help[, pack]])
Register a function as a SILE command. Takes any Lua function and registers it for use as a SILE command (which will in turn be used to process any content nodes identified with the command name.

Note that this should only be used to register commands supplied directly by a document class. A similar method is available for packages, packages:registerCommand.

Parameters:

  • name string Name of cammand to register.
  • func function Callback function to use as command handler.
  • help nil or string User friendly short usage string for use in error messages, documentation, etc. (optional)
  • pack nil or string Information identifying the module registering the command for use in error and usage messages. Usually auto-detected. (optional)

See also:

generated by LDoc 1.5.0 Last updated 1980-01-01 00:00:00