SharedContext

open class SharedContext(val parent: MutableContext, val fileSystem: FileSystem = parent.fileSystem) : MutableContext, ChildContext<MutableContext>

A context that shares all of its properties with its parent MutableContext. This is useful when a context needs to be forked, for example to update its fileSystem, but still its state mutably.

Parameters

parent

context this shared context was forked from

fileSystem

file system to use in this context

Constructors

Link copied to clipboard
constructor(parent: MutableContext, fileSystem: FileSystem = parent.fileSystem)

Properties

Link copied to clipboard
open override val attachedPipeline: <Error class: unknown class>

The pipeline this context is attached to, if it exists. A context can have up to 1 attached pipeline.

Link copied to clipboard
open override val attributes: <Error class: unknown class>
Link copied to clipboard
open override var documentInfo: <Error class: unknown class>

Mutable information about the final document that is being created.

Link copied to clipboard
open override val fileSystem: FileSystem
Link copied to clipboard
open override val flavor: MarkdownFlavor
Link copied to clipboard
open override val libraries: <Error class: unknown class>
Link copied to clipboard
open override val loadableLibraries: <Error class: unknown class>

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.

Link copied to clipboard
open override val localizationTables: <Error class: unknown class>

Tables that store key-value localization pairs for each supported locale. Each table is identified by a unique name.

Link copied to clipboard
open override val mediaStorage: <Error class: unknown class>

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.

Link copied to clipboard
open override val options: <Error class: unknown class>

Global properties that affect several behaviors and that can be altered through function calls.

Link copied to clipboard
open override val parent: MutableContext
Link copied to clipboard
open val root: Context

The root context of the scope tree that this context belongs to.

Link copied to clipboard
open override var sharedSubdocumentsData: <Error class: unknown class>

Data about all the subdocuments that are part of the document complex. This data is shared across all contexts involved in the document complex, regardless of the sandboxing level.

Link copied to clipboard
open override val subdocument: Subdocument
Link copied to clipboard

The directed graph of subdocuments that are part of the document complex.

Functions

Link copied to clipboard

Returns a copy of the queue containing registered function calls and clears the original one.

Link copied to clipboard
open override fun fork(): ScopeContext
Link copied to clipboard
open override fun getFunctionByName(name: String): Function<*>?

Looks up a function by name.

Link copied to clipboard
Link copied to clipboard
open fun lastParentOrNull(predicate: (Context) -> Boolean): Context?
Link copied to clipboard

Loads a loadable library by name and registers it in the context. After a successful load, the library is added to libraries, with its Library.onLoad action executed.

Link copied to clipboard
open override fun localize(tableName: String, key: String, locale: Locale): String

Localizes a string to this context's language (the locale set in documentInfo) by looking up a key in a localization table.

Link copied to clipboard
fun Context.localizeOrDefault(tableName: String = STDLIB_LOCALIZATION_TABLE_NAME, key: String): String?

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).

Link copied to clipboard
fun Context.localizeOrNull(tableName: String = STDLIB_LOCALIZATION_TABLE_NAME, key: String, locale: Locale? = null): String?

Localizes a key from a table.

Link copied to clipboard

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.

Link copied to clipboard
open fun newUuid(): String

Generates a new UUID via ContextOptions.uuidSupplier.

Link copied to clipboard
open fun register(linkDefinition: LinkDefinition)

Registers a new LinkDefinition, which can be later looked up via resolve to produce a concrete link from a reference.

open fun register(functionCall: FunctionCallNode)

Enqueues a new FunctionCallNode, which is executed in the next stage of the pipeline. Nothing happens if enqueuing is locked via lockFunctionCallEnqueuing.

Link copied to clipboard
open override fun resolve(reference: ReferenceLink): LinkNode?

Tries to resolve a reference link to an actual link. If the resolution succeeds, ReferenceLink.onResolve callbacks are executed.

open override fun resolve(call: FunctionCallNode): FunctionCall<*>?
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard