SubdocumentContext
A context that is the result of a fork from an original parent Context. All properties are inherited from it, but not all, such as libraries, are shared mutably.
This is mainly designed to be forked for subdocuments, where a new context is needed to process them. Each subdocument context shares most properties with its parent context, but maintains its own state for certain aspects like document info.
ScopeContext inherits from this class, and shares the parent's document info instead.
Parameters
context this scope was forked from
the subdocument this context is processing
file system to use in this context. Overrides the attached pipeline's file system if provided
Inheritors
Properties
The pipeline this context is attached to, if it exists. A context can have up to 1 attached pipeline.
Mutable information about the final document that is being created.
If a file system is provided during construction, it is used. Otherwise, BaseContext's implementation is used, which retrieves it from attachedPipeline.
External libraries that can be loaded by the user into libraries. These libraries are, for instance, fetched from the library directory (--libs option) and can be loaded via the .include {name} function.
Tables that store key-value localization pairs for each supported locale. Each table is identified by a unique name.
Media storage that contains all the media files that are referenced within the document. For example, if an image node references a local image file "image.png", the local file needs to be exported to the output directory in order for a browser to look it up. This storage is used to keep track of all the media files that may need to be exported.
Directed graph of the subdocuments that are part of the document complex. Each subdocument is a separate document file that can be rendered independently, and is referenced by a link from the main document or another subdocument.
Functions
Returns a copy of the queue containing registered function calls and clears the original one.
If no matching function is found among this SubdocumentContext's own libraries, parent's libraries are scanned.
Loads a loadable library by name and registers it in the context. After a successful load, the library is removed from loadableLibraries and added to libraries, with its Library.onLoad action executed.
Localizes a key from the stdlib table. If the key is not found in the context's locale, it falls back to the default locale (English).
Performs an action locking the enqueuing of function calls. This causes register to do nothing until the action is completed. Any function call enqueued during the action is discarded and won't be expanded by the pipeline.
Generates a new UUID via ContextOptions.uuidSupplier.
Registers a new LinkDefinition, which can be later looked up via resolve to produce a concrete link from a reference.
Enqueues a new FunctionCallNode, which is executed in the next stage of the pipeline. Nothing happens if enqueuing is locked via lockFunctionCallEnqueuing.
Tries to resolve a reference link to an actual link. If the resolution succeeds, ReferenceLink.onResolve callbacks are executed.