DocumentCursor

laika.ast.DocumentCursor
See theDocumentCursor companion object
class DocumentCursor extends Cursor

Cursor for a single document, its parent, siblings and root directories, its associated template and other context information that is required during a rewrite operation.

Value parameters

parent

the parent document tree of the referred document

resolver

the resolver for references in templates

target

the document this cursor points to

templatePath

the path of the template that has been applied to this document

Attributes

Companion
object
Source
Cursor.scala
Graph
Supertypes
trait Cursor
class Object
trait Matchable
class Any
Self type

Members list

Type members

Classlikes

class Siblings(documents: Vector[DocumentCursor])

Attributes

Source
Cursor.scala
Supertypes
class Object
trait Matchable
class Any

Types

type Target = Document

The type of the target this cursor points to.

The type of the target this cursor points to.

Attributes

Source
Cursor.scala

Value members

Concrete methods

Provides navigation capabilities to the siblings of this document where the entire hierarchical tree view is flattened into a single book-like list of documents.

Provides navigation capabilities to the siblings of this document where the entire hierarchical tree view is flattened into a single book-like list of documents.

Attributes

Source
Cursor.scala

The next document in a hierarchical tree view or None if this cursor points to the last document in the current sub-tree.

The next document in a hierarchical tree view or None if this cursor points to the last document in the current sub-tree. Use flattenedSiblings.nextDocument for navigation beyond the current sub-tree in a book-like flattened view.

Attributes

Source
Cursor.scala

The previous document in a hierarchical tree view or None if this cursor points to the first document in the current sub-tree.

The previous document in a hierarchical tree view or None if this cursor points to the first document in the current sub-tree. Use flattenedSiblings.previousDocument for navigation beyond the current sub-tree in a book-like flattened view.

Attributes

Source
Cursor.scala

Resolves the context reference with the specified path relative to this document.

Resolves the context reference with the specified path relative to this document. A reference config.value for example will first look up the value in the configuration of this document and then, if not found, recursively look it up in parent trees until the root tree is reached. If the value is not found None will be returned.

Attributes

Source
Cursor.scala

Returns a new, rewritten document model based on the specified rewrite rules.

Returns a new, rewritten document model based on the specified rewrite rules.

Attributes

Source
Cursor.scala

Returns a new, rewritten document model based on the specified rewrite rules.

Returns a new, rewritten document model based on the specified rewrite rules.

Attributes

Source
Cursor.scala

Validates the specified link, verifying that the target exists and supports a matching set of target formats.

Validates the specified link, verifying that the target exists and supports a matching set of target formats. The returned ADT provides one of three possible outcomes, apart from a valid or invalid result, a target may also be a RecoveredTarget where the link target exists, but does not support all the output formats of the link source. In such a case some link types can switch to an external link, pointing to the location of the hosted html result of this document tree.

Attributes

Source
Cursor.scala
def validate[L <: Link](link: L): Either[String, L]

Validates the specified link, verifying that the target exists and supports a matching set of target formats.

Validates the specified link, verifying that the target exists and supports a matching set of target formats. The returned link in case of successful validation might be a modified link with enhanced information for the renderer, which might translate internal links to external links for some output formats.

Attributes

Source
Cursor.scala

Validates the specified link, verifying that the target exists and supports a matching set of target formats.

Validates the specified link, verifying that the target exists and supports a matching set of target formats. Performs the same checks as the validate method, but instead of returning potential errors in an Either it replaces invalid links with instances of InvalidSpan. Those types of AST nodes require access to the original source that produced the element which is either obtained from a parser or from a directive combinator.

Attributes

Source
Cursor.scala

Creates a copy of this cursor with a new root object for resolving references.

Creates a copy of this cursor with a new root object for resolving references. This is useful for custom template directives which need to provide a new scope for a nested part inside the directive tags.

Attributes

Source
Cursor.scala

Concrete fields

val config: Config

The configuration for this document cursor, containing all config values of the underlying target document, plus additional values for navigating parents and siblings.

The configuration for this document cursor, containing all config values of the underlying target document, plus additional values for navigating parents and siblings.

Attributes

Source
Cursor.scala

Attributes

Source
Cursor.scala
val path: Path

The full, absolute path of the target of this cursor in the (virtual) document tree

The full, absolute path of the target of this cursor in the (virtual) document tree

Attributes

Source
Cursor.scala

The position of this node within the document tree.

The position of this node within the document tree.

Attributes

Source
Cursor.scala
lazy val root: RootCursor

The root cursor for this document tree.

The root cursor for this document tree.

Attributes

Source
Cursor.scala

The target within the document tree this cursor points to (a markup document or a sub-tree).

The target within the document tree this cursor points to (a markup document or a sub-tree).

Attributes

Source
Cursor.scala
val templatePath: Option[Path]

Attributes

Source
Cursor.scala