Numbered

class Numbered(val key: String, childrenSupplier: (location: String) -> List<Node>) : NestableNode, LocationTrackableNode

Node that can be numbered depending on its location in the document and the amount of occurrences according to its key.

This node is peculiar, as it's the only node whose children are not evaluated directly during the function call expansion stage, but rather during the AST traversal.

This is because in order to evaluate the children, we need to know the location of the node in the document, which is not known until the AST is fully traversed by com.quarkdown.core.context.hooks.location.LocationAwareLabelStorerHook.

After the traversal, the com.quarkdown.core.context.hooks.location.NumberedEvaluatorHook will evaluate and assign the children of this node, ready to be rendered.

Since the evaluation does not happen within com.quarkdown.core.function.call.FunctionCallNodeExpander, errors thrown during the evaluation will have to be caught externally. This is handled by the hook itself, which appends an error box (the same produced from the expander) to children. From the user's perspective, this does not have any effect.

Parameters

key

name to group (and count) numbered nodes

childrenSupplier

supplier of the node content given the evaluated SectionLocation, formatted according to the active DocumentNumbering

See also

Constructors

Link copied to clipboard
constructor(key: String, childrenSupplier: (location: String) -> List<Node>)

Properties

Link copied to clipboard

Whether this node should be tracked in the document's hierarchy.

Link copied to clipboard
open override var children: List<Node>
Link copied to clipboard
val key: String

Functions

Link copied to clipboard
open override fun <T> accept(visitor: NodeVisitor<T>): T

Accepts a visitor.

Link copied to clipboard

Returns a sequence of all nodes in the tree, where this is the root node. The sequence is generated by traversing the tree in depth-first order. The root node is excluded from the sequence.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Retrieves the stored media associated with this node, if any.

Link copied to clipboard

Registers the location of this node within the document handled by context.

Link copied to clipboard

Registers the formatted location of this node within the document handled by context, according to this node's NumberingFormat.

Link copied to clipboard