Summary
- Assembly
- Wyam
.Core .dll - Namespace
- Wyam
.Core .Modules .Metadata - Interfaces
- Base Types
-
- Object
Syntax
public class Tree : IModule
Remarks
By default, this module is configured to generate a tree that mimics the directory structure of each document's input path by looking at it's RelativeFilePath metadata value. Any documents with a file name of "index.*" are automatically promoted to the node that represents the parent folder level. For any folder that does not contain an "index.*" file, an empty placeholder tree node is used to represent the folder.
Note that if you clone documents from the tree, the relationships of the cloned document (parent, child, etc.) will not be updated to the new clones. In other words, your new document will still be pointing to the old versions of it's parent, children, etc. To update the tree after cloning documents you will need to recreate it by rerunning this module on all the newly created documents again.
Constructors
Name | Summary |
---|---|
Tree |
Creates a new tree module. |
Methods
Name | Value | Summary |
---|---|---|
Execute |
IEnumerable |
This should not be called directly, instead call
IExecutionContext.Execute() if you need to execute a module from within another module.
|
WithMetadataNames |
Tree |
Changes the default metadata keys.
|
WithNesting |
Tree |
Indicates that the module should only output root nodes (instead of all
nodes which is the default behavior).
|
With |
Tree |
Allows you to specify a factory function for the creation of placeholder documents which get
created to represent nodes in the tree for which there was no input document. The factory
gets passed the current tree path, the set of tree metadata that should be set in the document,
and the execution context which can be used to create a new document. If the factory function
returns null, a new document with the tree metadata is created.
|
WithRoots |
Tree |
Specifies for each document if it is a root of a tree. This results in splitting the generated tree into multiple smaller ones,
removing the root node from the set of children of it's parent and setting it's parent to
null .
|
WithSort |
Tree |
This specifies how the children of a given tree node should be sorted. The default behavior is to
sort based on the string value of the last component of the child node's tree path (I.e., the folder
or file name). The output document for each tree node is used as the input to the sort delegate.
|
WithTreePath |
Tree |
Defines the structure of the tree. If the delegate returns
null the document
is excluded from the tree.
|