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.
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 }
- Alphabetic
 - By Inheritance
 
- InputTreeBuilder
 - AnyRef
 - Any
 
- Hide All
 - Show All
 
- Public
 - All
 
Instance Constructors
-  new InputTreeBuilder(exclude: FileFilter, steps: Vector[BuilderStep[F]], fileRoots: Vector[FilePath])(implicit F: Async[F])
 
Value Members
- 
      
      
      
        
      
    
      
        final 
        def
      
      
        !=(arg0: Any): Boolean
      
      
      
- Definition Classes
 - AnyRef → Any
 
 - 
      
      
      
        
      
    
      
        final 
        def
      
      
        ##(): Int
      
      
      
- Definition Classes
 - AnyRef → Any
 
 - 
      
      
      
        
      
    
      
        final 
        def
      
      
        ==(arg0: Any): Boolean
      
      
      
- Definition Classes
 - AnyRef → Any
 
 - 
      
      
      
        
      
    
      
        
        def
      
      
        addBinaryStream(stream: Stream[F, Byte], mountPoint: Path): InputTreeBuilder[F]
      
      
      
Adds the specified input stream to the input tree, placing it at the specified mount point in the virtual tree.
Adds the specified input stream to the input tree, placing it at the specified mount point in the virtual tree.
The content type of the stream will be determined by the suffix of the virtual path, e.g.
doc.mdwould be passed to the markup parser,doc.template.htmlto the template parser, and so on.If the content type is text-based the stream will be decoded as UTF-8. In case a different codec is required, use
addTextStreamand decode the text beforehand. - 
      
      
      
        
      
    
      
        
        def
      
      
        addClassLoaderResource(name: String, mountPoint: Path, classLoader: ClassLoader = getClass.getClassLoader)(implicit codec: Codec): InputTreeBuilder[F]
      
      
      
Adds the specified classpath resource to the input tree, placing it at the specified mount point in the virtual tree.
Adds the specified classpath resource to the input tree, placing it at the specified mount point in the virtual tree. The specified name must be compatible with Java's
ClassLoader.getResource. The optionalClassLoaderargument can be used to ensure the resource is found in an application or plugin that uses multiple class loaders. If the call site is in the same module as the classpath resource, simply usinggetClass.getClassLoadershould suffice.The content type of the stream will be determined by the suffix of the virtual path, e.g.
doc.mdwould be passed to the markup parser,doc.template.htmlto the template parser, and so on. - 
      
      
      
        
      
    
      
        
        def
      
      
        addClassResource[T](name: String, mountPoint: Path)(implicit arg0: ClassTag[T], codec: Codec): InputTreeBuilder[F]
      
      
      
Adds the specified classpath resource to the input tree, placing it at the specified mount point in the virtual tree.
Adds the specified classpath resource to the input tree, placing it at the specified mount point in the virtual tree. The specified name must be compatible with Java's
Class.getResource. Relative paths will be interpreted as relative to the package name of the referenced class, with all.replaced by/.The content type of the stream will be determined by the suffix of the virtual path, e.g.
doc.mdwould be passed to the markup parser,doc.template.htmlto the template parser, and so on. - 
      
      
      
        
      
    
      
        
        def
      
      
        addConfig(config: Config, treePath: Path): InputTreeBuilder[F]
      
      
      
Adds the specified configuration instance and assigns it to the specified tree path in a way that is equivalent to having a HOCON file called
directory.confin that directory. - 
      
      
      
        
      
    
      
        
        def
      
      
        addDirectories(dirs: Seq[FilePath])(implicit codec: Codec): InputTreeBuilder[F]
      
      
      
Adds the specified directories to the input tree, merging them all into a single virtual root, recursively.
 - 
      
      
      
        
      
    
      
        
        def
      
      
        addDirectory(dir: FilePath, mountPoint: Path)(implicit codec: Codec): InputTreeBuilder[F]
      
      
      
Adds the specified directories to the input tree, placing it at the specified mount point in the virtual tree.
 - 
      
      
      
        
      
    
      
        
        def
      
      
        addDirectory(dir: FilePath)(implicit codec: Codec): InputTreeBuilder[F]
      
      
      
Adds the specified directories to the input tree, placing it in the virtual root.
 - 
      
      
      
        
      
    
      
        
        def
      
      
        addDirectory(name: String, mountPoint: Path)(implicit codec: Codec): InputTreeBuilder[F]
      
      
      
Adds the specified directories to the input tree, placing it at the specified mount point in the virtual tree.
 - 
      
      
      
        
      
    
      
        
        def
      
      
        addDirectory(name: String)(implicit codec: Codec): InputTreeBuilder[F]
      
      
      
Adds the specified directories to the input tree, placing it in the virtual root.
 - 
      
      
      
        
      
    
      
        
        def
      
      
        addDocument(doc: Document): InputTreeBuilder[F]
      
      
      
Adds the specified document AST to the input tree, by-passing the parsing step.
Adds the specified document AST to the input tree, by-passing the parsing step.
In some cases when generating input on the fly, it might be more convenient or more type-safe to construct the AST directly than to generate the text markup as input for the parser.
 - 
      
      
      
        
      
    
      
        
        def
      
      
        addFile(file: FilePath, mountPoint: Path)(implicit codec: Codec): InputTreeBuilder[F]
      
      
      
Adds the specified file to the input tree, placing it at the specified mount point in the virtual tree.
Adds the specified file to the input tree, placing it at the specified mount point in the virtual tree.
The content type of the stream will be determined by the suffix of the virtual path, e.g.
doc.mdwould be passed to the markup parser,doc.template.htmlto the template parser, and so on. - 
      
      
      
        
      
    
      
        
        def
      
      
        addFile(name: String, mountPoint: Path)(implicit codec: Codec): InputTreeBuilder[F]
      
      
      
Adds the specified file to the input tree, placing it at the specified mount point in the virtual tree.
Adds the specified file to the input tree, placing it at the specified mount point in the virtual tree.
The content type of the stream will be determined by the suffix of the virtual path, e.g.
doc.mdwould be passed to the markup parser,doc.template.htmlto the template parser, and so on. - 
      
      
      
        
      
    
      
        
        def
      
      
        addInputStream(stream: F[InputStream], mountPoint: Path, autoClose: Boolean = true)(implicit codec: Codec): InputTreeBuilder[F]
      
      
      
Adds the specified input stream to the input tree, placing it at the specified mount point in the virtual tree.
Adds the specified input stream to the input tree, placing it at the specified mount point in the virtual tree.
The content type of the stream will be determined by the suffix of the virtual path, e.g.
doc.mdwould be passed to the markup parser,doc.template.htmlto the template parser, and so on.The
autoCloseargument indicates whether the stream should be closed after use. In some integration scenarios with 3rd-party libraries, e.g. for PDF creation,autoCloseis not guaranteed as the handling of the stream is entirely managed by the 3rd party tool. - 
      
      
      
        
      
    
      
        
        def
      
      
        addProvidedPath(path: Path): InputTreeBuilder[F]
      
      
      
Adds a path to the input tree that represents a document getting processed by some external tool.
Adds a path to the input tree that represents a document getting processed by some external tool. Such a path will be used in link validation, but no further processing for this document will be performed.
 - 
      
      
      
        
      
    
      
        
        def
      
      
        addProvidedPaths(paths: Seq[Path]): InputTreeBuilder[F]
      
      
      
Adds the specified paths to the input tree that represent documents getting processed by some external tool.
Adds the specified paths to the input tree that represent documents getting processed by some external tool. Such a path will be used in link validation, but no further processing for this document will be performed.
 - 
      
      
      
        
      
    
      
        
        def
      
      
        addString(input: String, mountPoint: Path): InputTreeBuilder[F]
      
      
      
Adds the specified string resource to the input tree, placing it at the specified mount point in the virtual tree.
Adds the specified string resource to the input tree, placing it at the specified mount point in the virtual tree.
The content type of the stream will be determined by the suffix of the virtual path, e.g. *
doc.mdwould be passed to the markup parser,doc.template.htmlto the template parser, and so on. - 
      
      
      
        
      
    
      
        
        def
      
      
        addStyles(styles: Set[StyleDeclaration], path: Path, precedence: Precedence = Precedence.High): InputTreeBuilder[F]
      
      
      
Adds the specified styles for PDF to the input tree.
Adds the specified styles for PDF to the input tree. These type of style declarations are only used in the context of Laika's "CSS for PDF" support which works slightly differently than web CSS as PDF generation in Laika is not based on interim HTML results.
 - 
      
      
      
        
      
    
      
        
        def
      
      
        addTemplate(doc: TemplateDocument): InputTreeBuilder[F]
      
      
      
Adds the specified template AST to the input tree, by-passing the parsing step.
Adds the specified template AST to the input tree, by-passing the parsing step.
In some cases when generating input on the fly, it might be more convenient or more type-safe to construct the AST directly than to generate the template as a string as input for the template parser.
 - 
      
      
      
        
      
    
      
        
        def
      
      
        addTextStream(stream: Stream[F, String], mountPoint: Path): InputTreeBuilder[F]
      
      
      
Adds the specified input stream to the input tree, placing it at the specified mount point in the virtual tree.
Adds the specified input stream to the input tree, placing it at the specified mount point in the virtual tree.
The content type of the stream will be determined by the suffix of the virtual path, e.g.
doc.mdwould be passed to the markup parser,doc.template.htmlto the template parser, and so on.If the target content type is binary the stream will be encoded as UTF-8. In case a different codec is required, use
addBinaryStreamand encode the text beforehand. - 
      
      
      
        
      
    
      
        final 
        def
      
      
        asInstanceOf[T0]: T0
      
      
      
- Definition Classes
 - Any
 
 - 
      
      
      
        
      
    
      
        
        def
      
      
        build(docTypeMatcher: (Path) ⇒ DocumentType): F[InputTree[F]]
      
      
      
Builds the tree based on the inputs added to this instance and the specified custom document type matcher.
Builds the tree based on the inputs added to this instance and the specified custom document type matcher.
The method is effectful as it might involve scanning directories to determine the tree structure.
This method is normally not called by application code directly, as the parser and transformer APIs expect an
InputTreeBuilderinstance. - 
      
      
      
        
      
    
      
        
        def
      
      
        build: F[InputTree[F]]
      
      
      
Builds the tree based on the inputs added to this instance.
Builds the tree based on the inputs added to this instance.
The method is effectful as it might involve scanning directories to determine the tree structure.
This method is normally not called by application code directly, as the parser and transformer APIs expect an
InputTreeBuilderinstance. - 
      
      
      
        
      
    
      
        
        def
      
      
        clone(): AnyRef
      
      
      
- Attributes
 - protected[lang]
 - Definition Classes
 - AnyRef
 - Annotations
 - @throws( ... ) @native() @HotSpotIntrinsicCandidate()
 
 - 
      
      
      
        
      
    
      
        
        def
      
      
        describe(docTypeMatcher: (Path) ⇒ DocumentType): F[TreeInputDescriptor]
      
      
      
Provides a description of this input tree.
Provides a description of this input tree. Input directories will be scanned or reported in case they don't exist. Documents added to this builder individually will be listed without additional checks.
This functionality is mostly intended for tooling support.
 - 
      
      
      
        
      
    
      
        final 
        def
      
      
        eq(arg0: AnyRef): Boolean
      
      
      
- Definition Classes
 - AnyRef
 
 - 
      
      
      
        
      
    
      
        
        def
      
      
        equals(arg0: Any): Boolean
      
      
      
- Definition Classes
 - AnyRef → Any
 
 - 
      
      
      
        
      
    
      
        final 
        def
      
      
        getClass(): Class[_]
      
      
      
- Definition Classes
 - AnyRef → Any
 - Annotations
 - @native() @HotSpotIntrinsicCandidate()
 
 - 
      
      
      
        
      
    
      
        
        def
      
      
        hashCode(): Int
      
      
      
- Definition Classes
 - AnyRef → Any
 - Annotations
 - @native() @HotSpotIntrinsicCandidate()
 
 - 
      
      
      
        
      
    
      
        final 
        def
      
      
        isInstanceOf[T0]: Boolean
      
      
      
- Definition Classes
 - Any
 
 - 
      
      
      
        
      
    
      
        
        def
      
      
        merge(other: InputTree[F]): InputTreeBuilder[F]
      
      
      
Merges this input tree with the specified tree, recursively.
 - 
      
      
      
        
      
    
      
        
        def
      
      
        merge(other: InputTreeBuilder[F]): InputTreeBuilder[F]
      
      
      
Merges this input tree with the specified tree, recursively.
 - 
      
      
      
        
      
    
      
        final 
        def
      
      
        ne(arg0: AnyRef): Boolean
      
      
      
- Definition Classes
 - AnyRef
 
 - 
      
      
      
        
      
    
      
        final 
        def
      
      
        notify(): Unit
      
      
      
- Definition Classes
 - AnyRef
 - Annotations
 - @native() @HotSpotIntrinsicCandidate()
 
 - 
      
      
      
        
      
    
      
        final 
        def
      
      
        notifyAll(): Unit
      
      
      
- Definition Classes
 - AnyRef
 - Annotations
 - @native() @HotSpotIntrinsicCandidate()
 
 - 
      
      
      
        
      
    
      
        final 
        def
      
      
        synchronized[T0](arg0: ⇒ T0): T0
      
      
      
- Definition Classes
 - AnyRef
 
 - 
      
      
      
        
      
    
      
        
        def
      
      
        toString(): String
      
      
      
- Definition Classes
 - AnyRef → Any
 
 - 
      
      
      
        
      
    
      
        final 
        def
      
      
        wait(arg0: Long, arg1: Int): Unit
      
      
      
- Definition Classes
 - AnyRef
 - Annotations
 - @throws( ... )
 
 - 
      
      
      
        
      
    
      
        final 
        def
      
      
        wait(arg0: Long): Unit
      
      
      
- Definition Classes
 - AnyRef
 - Annotations
 - @throws( ... ) @native()
 
 - 
      
      
      
        
      
    
      
        final 
        def
      
      
        wait(): Unit
      
      
      
- Definition Classes
 - AnyRef
 - Annotations
 - @throws( ... )
 
 - 
      
      
      
        
      
    
      
        
        def
      
      
        withFileFilter(newFilter: FileFilter): InputTreeBuilder[F]
      
      
      
Adds the specified file filter to this input tree.
Adds the specified file filter to this input tree.
The filter will only be used for scanning directories when calling
addDirectoryon this builder, not for any of the other methods. 
Deprecated Value Members
- 
      
      
      
        
      
    
      
        
        def
      
      
        addClasspathResource(name: String, mountPoint: Path)(implicit codec: Codec): InputTreeBuilder[F]
      
      
      
- Annotations
 - @deprecated
 - Deprecated
 (Since version 0.19.0) Use addClassResource or addClassLoaderResource
 - 
      
      
      
        
      
    
      
        
        def
      
      
        addDirectory(dir: File, mountPoint: Path)(implicit codec: Codec): InputTreeBuilder[F]
      
      
      
- Annotations
 - @deprecated
 - Deprecated
 (Since version 0.19.0) use addDirectory(String, Path) or addDirectory(FilePath, Path)
 - 
      
      
      
        
      
    
      
        
        def
      
      
        addDirectory(dir: File)(implicit codec: Codec): InputTreeBuilder[F]
      
      
      
- Annotations
 - @deprecated
 - Deprecated
 (Since version 0.19.0) use addDirectory(String) or addDirectory(FilePath)
 - 
      
      
      
        
      
    
      
        
        def
      
      
        addFile(file: File, mountPoint: Path)(implicit codec: Codec): InputTreeBuilder[F]
      
      
      
- Annotations
 - @deprecated
 - Deprecated
 (Since version 0.19.0) use addFile(String) or addFile(FilePath)
 - 
      
      
      
        
      
    
      
        
        def
      
      
        addStream(stream: F[InputStream], mountPoint: Path, autoClose: Boolean = true)(implicit codec: Codec): InputTreeBuilder[F]
      
      
      
- Annotations
 - @deprecated
 - Deprecated
 (Since version 0.19.0) use addInputStream
 - 
      
      
      
        
      
    
      
        
        def
      
      
        finalize(): Unit
      
      
      
- Attributes
 - protected[lang]
 - Definition Classes
 - AnyRef
 - Annotations
 - @throws( classOf[java.lang.Throwable] ) @Deprecated
 - Deprecated