Module resilient.bootstrap
Bootstrap code for re·sil·ient.
Info:
- Copyright: (c) 2025 Omikhkeia / Didier Willis
- License: MIT
Functions
SILE.resilient.cancelContextualCommands (context, func) | Temporarilly cancels "fragile" commands. |
SILE.resilient.enforceContextualCommand (command) | Make a command "robust" (cancelled in certain contexts). |
SILE.resilient.enforceContextChangingCommand (context, command) | Make a command context-switching. |
SILE.resilient.enforceSilentTypesetterAndPagebuilder () | Activate the sile·nt typesetter and the page·ant pagebuilder. |
Functions
- SILE.resilient.cancelContextualCommands (context, func)
-
Temporarilly cancels "fragile" commands.
Typically, these are commands such as footnotes and labels.
Such commands break when used in moving arguments (like table of contents entries, running headers, etc.) The need to cancel them derives from the fact that AST content is stored and reused in different contexts.
For instance, consider a title that contains a footnote. The title AST is stored in the TOC, and reused when typesetting the TOC. The footnote command would try to create a footnote at that point, which is not what one expects.
Parameters:
- context string A context identifier corresponding to the suppression purpose
- func function The function to execute without fragile commands
- SILE.resilient.enforceContextualCommand (command)
-
Make a command "robust" (cancelled in certain contexts).
The command will be ignored when in a context where fragile commands are to be cancelled.
TRANSITIONAL: This utility allows enforcing an existing command to be robust globally, when it was not written as such initially. This is useful for commands that are known to be "fragile", such as footnotes and labels, in their original non-context-switching implementation.
Parameters:
- command string The command name to make robust
- SILE.resilient.enforceContextChangingCommand (context, command)
-
Make a command context-switching.
This utility is useful fwhen a command needs to process content in a context where fragile commands are ignored, but the command itself was not written to switch context for its own processing.
The command is not fragile itself, per se, but it processes content that may contain fragile commands, such as label references, and should have taken care of cancelling them at appropriate times.
TRANSITIONAL: This utility allows enforcing an existing command to be context-switching globally, when it does not invoke the cancellation of fragile commands by itself initially.
Parameters:
- SILE.resilient.enforceSilentTypesetterAndPagebuilder ()
-
Activate the sile·nt typesetter and the page·ant pagebuilder.
These are "new" implementations of the typesetter and pagebuilder for re·sil·ient.
They act as full replacements to SILE's base typesetter and pagebuilder, when processing a resilient document.
TRANSITIONAL: This is highly linked to the way SILE instantiates typesetters and pagebuilders, which changed multiple times.