BaseContext

open class BaseContext(val attributes: AstAttributes, val flavor: MarkdownFlavor, val libraries: Set<Library> = emptySet()) : Context

An immutable Context implementation. This might be used in tests as a toy context, but in a concrete execution, its mutable subclass MutableContext is used.

Parameters

attributes

attributes of the node tree, produced by the parsing stage

flavor

Markdown flavor used for this pipeline. It specifies how to produce the needed components

libraries

loaded libraries to look up functions from

Inheritors

Constructors

Link copied to clipboard
constructor(attributes: AstAttributes, flavor: MarkdownFlavor, libraries: Set<Library> = emptySet())

Properties

Link copied to clipboard
open override val attachedPipeline: Pipeline?

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: AstAttributes
Link copied to clipboard
open override val documentInfo: DocumentInfo

Mutable information about the final document that is being created.

Link copied to clipboard
open override val flavor: MarkdownFlavor
Link copied to clipboard
open override val libraries: Set<Library>
Link copied to clipboard
open override val loadableLibraries: Set<Library>

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

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

Link copied to clipboard

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: ContextOptions

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

Functions

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
open override fun localize(tableName: String, key: String): 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

Localizes a key from the stdlib table.

fun Context.localizeOrNull(tableName: String, key: String): String?

Localizes a key from a table.

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