DocumentCursor

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

Companion:
object
trait Serializable
trait Product
trait Equals
trait Cursor
class Object
trait Matchable
class Any

Type members

Classlikes

class Siblings(documents: Vector[DocumentCursor])

Types

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.

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.

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.

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.

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

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

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

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

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.

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.

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.

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.

Inherited methods

def productElementNames: Iterator[String]
Inherited from:
Product
def productIterator: Iterator[Any]
Inherited from:
Product

Concrete fields

val path: Path
lazy val root: RootCursor