DocumentCursor

laika.ast.DocumentCursor
See theDocumentCursor companion object
case class DocumentCursor(target: Document, parent: TreeCursor, resolver: ReferenceResolver, config: Config, templatePath: Option[Path], position: TreePosition) 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

config

the configuration associated with the target document

parent

the parent document tree of the referred document

position

the position of the target document inside a tree hierarchy

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
Graph
Supertypes
trait Serializable
trait Product
trait Equals
trait Cursor
class Object
trait Matchable
class Any
Show all
Self type

Members list

Type members

Classlikes

class Siblings(documents: Vector[DocumentCursor])

Attributes

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

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

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.

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

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.

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

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.

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

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

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

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.

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

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

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

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.

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

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.

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

Inherited methods

def productElementNames: Iterator[String]

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

Attributes

Inherited from:
Product

Concrete fields

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

lazy val root: RootCursor

The root cursor for this document tree.

The root cursor for this document tree.

Attributes