package model
- Alphabetic
- Public
- All
Type Members
-
case class
BinaryInput[F[_]](input: Stream[F, Byte], path: Path, formats: TargetFormats = TargetFormats.All, sourceFile: Option[FilePath] = None)(implicit evidence$1: Sync[F]) extends Navigatable with Product with Serializable
A binary input stream and its virtual path within the input tree.
A binary input stream and its virtual path within the input tree.
- input
The binary input
- path
The full virtual path of this input (does not represent the filesystem path in case of file I/O), the point within the virtual tree of inputs (usually a
DocumentTree
) this resource should be linked into.- formats
Indicates the output formats this binary input should be included in; by default binary resources are included in all output formats, but it can be restricted if necessary (e.g. to only include it in HTML output, but omit it from PDF or EPUB)
- sourceFile
The source file from the file system, empty if this does not represent a file system resource
-
case class
BinaryOutput[F[_]](resource: Resource[F, OutputStream], path: Path, targetFile: Option[File] = None) extends Product with Serializable
A resource for binary output.
A resource for binary output.
Most renderers write character data, but formats like PDF or EPUB require a binary stream to write to.
This is the only I/O type not expressed through a generic
F[_]
or anfs2.Stream
orfs2.Pipe
as Laika's binary output needs to work with Java libraries for its EPUB and PDF output. -
case class
DirectoryInput(directories: Seq[FilePath], codec: Codec, docTypeMatcher: (Path) ⇒ DocumentType = DocumentTypeMatcher.base, fileFilter: FileFilter = DirectoryInput.hiddenFileFilter, mountPoint: Path = Root) extends Product with Serializable
A directory in the file system containing input documents for a tree transformation.
A directory in the file system containing input documents for a tree transformation.
The specified
docTypeMatcher
is responsible for determining the type of input (e.g. text markup, template, etc.) based on the (virtual) document path. -
case class
DirectoryOutput(directory: FilePath, codec: Codec) extends TreeOutput with Product with Serializable
A directory as a target for a rendering operation of a document tree.
A directory as a target for a rendering operation of a document tree.
The specified codec will be used for writing all character output.
-
trait
FileFilter extends AnyRef
File filter that defines the filter function in
[F[_]]
to allow for effectful filter logic. -
class
FilePath extends GenericPath
Represents an absolute path on the file system, pointing to a file or directory that may or may not exist.
Represents an absolute path on the file system, pointing to a file or directory that may or may not exist. Relative paths are interpreted as relative to the current working directory.
This type has a lot of shared API with the
VirtualPath
abstraction inlaika-core
via their common super-traitGenericPath
. Like the virtual path API it comes with convenience methods for querying and modifying suffix and fragment components, a common requirement in processing internal links for example.However, it differs in three ways from the virtual path abstraction: first, semantically, as the latter is never intended to represent an actual file and instead just describes a tree structure of inputs (and AST documents after parsing).
Secondly, this type comes with additional APIs to convert to and from other path representations, namely
java.io.File
,java.nio.file.Path
andfs2.io.file.Path
.And finally, the
toString
method for this type returns a platform-dependent string representation by using the file separator of the underlying file system. Laika's virtual path abstractions on the other hand always uses a forward slash/
as the separator.Having a dedicated file path abstraction also helps with type signatures for methods in Laika's APIs that accept two path arguments: a file path and a virtual path indicating the mount point (at which the specified file is supposed to be inserted into the virtual tree).
-
case class
InputTree[F[_]](textInputs: Seq[TextInput[F]] = Nil, binaryInputs: Seq[BinaryInput[F]] = Nil, parsedResults: Seq[ParserResult] = Nil, providedPaths: Seq[StaticDocument] = Nil, sourcePaths: Seq[FilePath] = Nil) extends Product with Serializable
A (virtual) tree of input documents, either obtained from scanning a directory recursively or constructed programmatically (or a mix of both).
A (virtual) tree of input documents, either obtained from scanning a directory recursively or constructed programmatically (or a mix of both).
Even though the documents are specified as a flat sequence, they logically form a tree based on their virtual path.
-
class
InputTreeBuilder[F[_]] extends AnyRef
Builder API for freely constructing input trees from directories, files, classpath resources, in-memory strings or pre-constructed AST trees.
Builder API for freely constructing input trees from directories, files, classpath resources, in-memory strings or pre-constructed AST trees.
If your input is just one or more directories, you can use the corresponding shortcuts on the parser or transformer instances, e.g.
transformer.fromDirectory(...).toDirectory(...)
. This builder is meant to be used for situations where more flexibility is required.All the specified inputs will be combined into a single logical tree and each document gets a virtual path assigned that describes its logical position within the tree. As a consequence all cross-linking or referencing of images can happen within the virtual path abstraction, meaning a resource from the file system can point to an input constructed in-memory via a relative, virtual path.
When adding strings, files or directories you need to specify a "mount point" that signals where within the virtual tree the inputs should be placed. For adding directories the mount point is optional, when omitted the directory becomes the virtual root of the input tree.
The resulting input tree can be passed to parsers, transformers and theme builders.
Example for composing inputs from two directories, a template loaded from the classpath and a CSS file generated in-memory:
val inputs = InputTree[F] .addDirectory("/path-to-my/markup-files") .addDirectory("/path-to-my/images", Root / "images") .addClasspathResource("my-templates/default.template.html", DefaultTemplatePath.forHTML) .addString(generateMyStyles(), Root / "css" / "site.css")
These inputs can then be configured for the sbt plugin:
laikaInputs := inputs
Or passed to a
TreeTransformer
instance:val res: F[RenderedTreeRoot[F]] = transformer.use { _.fromInputTree(inputs) .toDirectory("target") .transform }
-
case class
ParsedTree[F[_]](root: DocumentTreeRoot, staticDocuments: Seq[BinaryInput[F]]) extends Product with Serializable
The result of a parsing operation for an entire document tree.
The result of a parsing operation for an entire document tree.
The
DocumentTreeRoot
is the recursive structure of parsed inputs, like markup document, templates or other file types, represented by their AST.The static documents are merely a sequence of unprocessed inputs that have been discovered via directory scanning (or have been passed programmatically). The actual processing of these inputs is left to the render step, which might copy them into a target directory, or embed them into an output format like EPUB.
-
sealed
trait
RenderContent extends Navigatable
A titled, positional element in the tree of rendered documents.
-
case class
RenderedDocument(path: Path, title: Option[SpanSequence], sections: Seq[SectionInfo], content: String, config: Config) extends RenderContent with DocumentNavigation with Product with Serializable
A single rendered document with the content as a plain string in the target format.
A single rendered document with the content as a plain string in the target format.
The title and section info are still represented as an AST, so they be used in any subsequent step that needs to produce navigation structures.
-
case class
RenderedTree(path: Path, title: Option[SpanSequence], content: Seq[RenderContent], titleDocument: Option[RenderedDocument] = None) extends RenderContent with Product with Serializable
Represents a node of the tree of rendered documents.
Represents a node of the tree of rendered documents.
- path
the full, absolute path of this (virtual) document tree
- title
the title of this tree, either obtained from the title document or configuration
- content
the rendered documents and subtrees in a recursive structure
- titleDocument
the optional title document of this tree
-
case class
RenderedTreeRoot[F[_]](tree: RenderedTree, defaultTemplate: TemplateRoot, config: Config, outputContext: OutputContext, pathTranslator: PathTranslator, styles: StyleDeclarationSet = StyleDeclarationSet.empty, coverDocument: Option[RenderedDocument] = None, staticDocuments: Seq[BinaryInput[F]] = Nil) extends Product with Serializable
Represents the root of a tree of rendered documents.
Represents the root of a tree of rendered documents. In addition to the recursive structure of documents it holds additional items like static or cover documents, which may contribute to the output of a site or an e-book.
- tree
the recursive structure of documents, usually obtained from parsing text markup
- defaultTemplate
the default template configured for the output format, which may be used by a post-processor
- config
the root configuration of the rendered tree
- outputContext
the context for the output format used in rendering (file suffix and format selector)
- pathTranslator
the path translator specific to the output format produced by the renderer
- coverDocument
the cover document (usually used with e-book formats like EPUB and PDF)
- staticDocuments
the paths of documents that were neither identified as text markup, config or templates, and will potentially be embedded or copied as is to the final output, depending on the output format
-
case class
TextInput[F[_]](input: F[String], path: Path, docType: TextDocumentType, sourceFile: Option[FilePath] = None)(implicit evidence$1: Functor[F]) extends Navigatable with Product with Serializable
Character input for the various parsers of this library and its virtual path within the input tree.
Character input for the various parsers of this library and its virtual path within the input tree.
- input
The character input
- path
The full virtual path of this input (does not represent the filesystem path in case of file I/O), the point within the virtual tree of inputs (usually a
DocumentTree
) this resource should be linked into.- docType
Indicates the type of the document, to distinguish between text markup, templates, configuration and style sheets, which all have a different kind of parser
- sourceFile
The source file from the file system, empty if this does not represent a file system resource
-
case class
TextOutput[F[_]](writer: Writer[F], path: Path, targetFile: Option[FilePath] = None) extends Product with Serializable
Character output for the various renderers of this library
Character output for the various renderers of this library
- writer
Handler for the character output (a function
String => F[Unit]
)- path
The full virtual path of this output (does not represent the filesystem path in case of file I/O)
- targetFile
The target file in the file system, empty if this does not represent a file system resource
-
sealed
trait
TreeOutput extends AnyRef
A (virtual) tree of output documents.
Value Members
- object BinaryInput extends Serializable
- object BinaryOutput extends Serializable
- object DirectoryInput extends Serializable
- object FileFilter
-
object
FilePath
Companion for parsing path strings or creating
FilePath
instances from other path representations. -
object
InputTree extends Serializable
Factory methods for creating
InputTreeBuilder
instances. -
object
StringTreeOutput extends TreeOutput with Product with Serializable
Instructs the renderer to produce an in-memory representation of the tree of rendered outputs.
- object TextInput extends Serializable
- object TextOutput extends Serializable