Document

laika.ast.Document
case class Document(path: Path, content: RootElement, fragments: Map[String, Element], config: Config, position: TreePosition) extends DocumentStructure, TreeContent

Represents a single document and provides access to the document content and structure as well as hooks for triggering rewrite operations.

Value parameters

config

the configuration for this document

content

the tree model obtained from parsing the markup document

fragments

separate named fragments that had been extracted from the content

path

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

position

the position of this document inside a document tree hierarchy, expressed as a list of Ints

Attributes

Graph
Supertypes
trait Serializable
trait Product
trait Equals
trait TreeContent
trait Navigatable
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

def appendContent(content: Block, contents: Block*): Document

Appends the specified content to this tree and return a new instance.

Appends the specified content to this tree and return a new instance.

Attributes

def appendContent(newContent: Seq[Block]): Document

Appends the specified content to this tree and return a new instance.

Appends the specified content to this tree and return a new instance.

Attributes

def prependContent(content: Block, contents: Block*): Document

Prepends the specified content to this tree and return a new instance.

Prepends the specified content to this tree and return a new instance.

Attributes

def prependContent(newContent: Seq[Block]): Document

Prepends the specified content to this tree and return a new instance.

Prepends the specified content to this tree and return a new instance.

Attributes

def rewrite(rules: RewriteRules): Either[ConfigError, Document]

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

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

If the rule is not defined for a specific element or the rule returns a Retain action as a result the old element remains in the tree unchanged.

If it returns Remove then the node gets removed from the ast, if it returns Replace with a new element it will replace the old one.

The rewriting is performed bottom-up (depth-first), therefore any element container passed to the rule only contains children which have already been processed.

Attributes

Inherited methods

Creates the navigation structure for this document up to the specified depth. The returned instance can be used as part of a bigger navigation structure comprising of trees, documents and their sections.

Creates the navigation structure for this document up to the specified depth. The returned instance can be used as part of a bigger navigation structure comprising of trees, documents and their sections.

Value parameters

context

captures the navigation depth, reference path and styles for the navigation tree being built

Attributes

Returns

a navigation item that can be used as part of a bigger navigation structure comprising of trees, documents and their sections

Inherited from:
DocumentNavigation

Attributes

Inherited from:
DocumentStructure
def productElementNames: Iterator[String]

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

Attributes

Inherited from:
Product

Attributes

Inherited from:
DocumentStructure

The formats this tree content should be rendered to.

The formats this tree content should be rendered to.

Attributes

Inherited from:
TreeContent
def title: Option[SpanSequence]

The title of this document, obtained from the document structure or from the configuration. In case no title is defined in either of the two places the result will be None.

The title of this document, obtained from the document structure or from the configuration. In case no title is defined in either of the two places the result will be None.

Attributes

Inherited from:
DocumentStructure
protected def titleFromConfig: Option[SpanSequence]

Attributes

Inherited from:
TreeContent

Inherited fields

lazy val name: String

The local name of this navigatable.

The local name of this navigatable.

Attributes

Inherited from:
Navigatable
lazy val sections: Seq[SectionInfo]

The section structure of this document based on the hierarchy of headers found in the original text markup.

The section structure of this document based on the hierarchy of headers found in the original text markup.

Attributes

Inherited from:
DocumentStructure