Module classes.resilient.override
Top-level super-class for re·sil·ient document classes.
Opinionated changes and overrides to SILE's standard base document class behavior.
Info:
- Copyright: (c) 2023-2025 Omikhleia / Didier Willis
- License: MIT
Class classes.resilient.override
class:_init (options) | (Constructor) Initialize the class. |
class:declareOptions () | (Override) Declare class options. |
class:loadPackage (packname, options) | (Override) Load a package. |
class:registerCommands () | (Override) Register class commands. |
class:finish () | (Override) Finish the document. |
Class classes.resilient.override
The base document class for re·sil·ient documents.
Extends SILE's classes.base
.
It deviates from SILE's implementation in several ways:
- It replaces SILE's default typesetter with the sile·nt typesetter?
- It does not used SILE's "plain" document class, but implements minimal compatibility via packages.
- It cancels multiple package instantiation, as some of our packages are stateful.
- class:_init (options)
-
(Constructor) Initialize the class.
It enforces the use for the sile·nt typesetter. It loads the packages.resilient.plain and
bidi
packages for compatibility.Parameters:
- options table Class options
- class:declareOptions ()
-
(Override) Declare class options.
The options added here are:
- direction: text direction (option from SILE's "plain" class, but "bidi"-related)
- resolution: resolution in DPI (specific to resilient)
- class:loadPackage (packname, options)
-
(Override) Load a package.
Packages such as packages.resilient.styles are stateful and freeze the styles at some point in their workflow.
The multiple package instantiation model was introduced in SILE 0.13-0.14. I struggled too many times with this issue in August 2022 (initial effort porting my 0.12.5 packages to 0.14.x) and afterwards. See SILE issue 1531 for some details. I could never make any sense of this "feature", which introduces unintended side-effects and problems difficult to decently address. Some of the issues were supposed to be fixed in SILE 0.15, but removing the hacks below still breaks (at least) the styling logic. SILE's standard method has an extra "reload" argument, which we do not use here. There is no way to distinguish between a new package instantiation and a non-forced reload. Some classes and packages need to modify and extend commands from other packages, but package reloading can break this.
In brief: we cancel the multiple package instantiation.
Parameters:
- class:registerCommands ()
-
(Override) Register class commands.
It provides bidi-related commands that were originally in SILE's "bidi" package, since we no longer load it (its functionality being integrated in the sile·nt typesetter).
- class:finish ()
- (Override) Finish the document.