Module classes.resilient.base

The base style-aware document class for re·sil·ient.

It provides a base class for document classes that want to use styles, following the re·sil·ient styling paradigm, with a few convenience methods hide the internals.

Info:

  • Copyright: (c) 2023-2025 Omikhleia / Didier Willis
  • License: MIT

Class classes.resilient.base

class:_init (options) (Constructor) Initialize the class.
class:loadPackage (packname, options) (Override) Load a package, using a style-aware alternative if available.
class:registerStyle (name, opts, styledef) Register a style.
class:resolveStyle (name[, discardable]) Resolve a style name into a style definition.
class:hasStyle (name) Check if a style is defined.
class:registerStyles () (Abstract) Register all styles.


Class classes.resilient.base

The base document class for re·sil·ient documents.

Extends classes.resilient.override.

class:_init (options)
(Constructor) Initialize the class.

It initialize the parent class, loads the packages.resilient.styles module, and invokes the registerStyles() method, which is a convenient hook for subclasses where to register all their styles.

Parameters:

  • options table Class options
class:loadPackage (packname, options)
(Override) Load a package, using a style-aware alternative if available.

Some core or 3rd-party packages may load a non-style-aware variant of another package, and this would cause issues with the commands being redefined to the non-style-aware variant.

We enforce loading the resilient style-aware variant instead, assuming compatibility (though we cannot fully guarantee it).

Parameters:

  • packname string Package name
  • options table Package options
class:registerStyle (name, opts, styledef)
Register a style.

Parameters:

  • name string Style name
  • opts table Style options
  • styledef table Style definition
class:resolveStyle (name[, discardable])
Resolve a style name into a style definition.

Parameters:

  • name string Style name
  • discardable boolean If true, do not raise an error if the style is not found (optional)

Returns:

    table or nil Style definition
class:hasStyle (name)
Check if a style is defined.

Parameters:

Returns:

    boolean True if the style is defined
class:registerStyles ()
(Abstract) Register all styles.

For overriding in any document subclass, as a convenient hook where to register all styles.

generated by LDoc 1.5.0 Last updated 2025-09-14 22:28:52