GatherHeadings Class
Queries HTML content of the input documents and adds a metadata value that contains it's headings.
Namespace
Statiq.Core
Interfaces
Base Types
graph BT Type-->Base0["ParallelConfigModule<int>"] Base0-->Base1["Module"] click Base1 "/api/Statiq.Common/Module" Base1-->Base2["object"] Type-.->Interface0["IModule"] click Interface0 "/api/Statiq.Common/IModule" Type-.->Interface1["IParallelModule"] click Interface1 "/api/Statiq.Common/IParallelModule" Type["GatherHeadings"] class Type type-node

Syntax

public class GatherHeadings : ParallelConfigModule<int>, IModule, IParallelModule

Remarks

A new document is created for each heading, all of which are placed into a IReadOnlyList<IDocument> in the metadata of each input document. The new heading documents contain metadata with the level of the heading, the children of the heading (the following headings with one deeper level) and optionally the heading content, which is also set as the content of each document. The output of this module is the input documents with the additional metadata value containing the documents that present each heading.

Constructors

Methods

Name Return Value Summary
AfterExecution(IExecutionContext, ExecutionOutputs) void
Called after each module execution.
Inherited from Module
AfterExecutionAsync(IExecutionContext, ExecutionOutputs) Task
Called after each module execution.
Inherited from Module
BeforeExecution(IExecutionContext) void
Called before each module execution.
Inherited from Module
BeforeExecutionAsync(IExecutionContext) Task
Called before each module execution.
Inherited from Module
ExecuteAsync(IExecutionContext) Task<IEnumerable<IDocument>>
This should not be called directly, instead call IExecutionContext.Execute() if you need to execute a module from within another module.
Inherited from Module
ExecuteConfigAsync(IDocument, IExecutionContext, int) Task<IEnumerable<IDocument>>
Finally(IExecutionContext) void
Called after each module execution, even if an exception is thrown during execution.
Inherited from Module
FinallyAsync(IExecutionContext) Task
Called after each module execution, even if an exception is thrown during execution.
Inherited from Module
GetHeadingQuery(int) string
static
WithChildrenKey(string) GatherHeadings
Sets the key to use in the heading documents to store the children of a given heading. In other words, the metadata for this key will contain all the headings following the one in the document with a level one deeper than the current heading.
WithHeadingKey(string) GatherHeadings
Sets the key to use for storing the heading content in the heading documents. The default is null which means only store the heading content in the content of the heading document. Setting this can be useful when you want to use the heading documents in downstream modules, setting their content to something else while maintaining the heading content in metadata.
WithIdKey(string) GatherHeadings
Sets the key to use in the heading documents to store the heading id attribute (if it has one).
WithLevelKey(string) GatherHeadings
Sets the key to use in the heading documents to store the level.
WithMetadataKey(string) GatherHeadings
Allows you to specify an alternate metadata key for the heading documents.
WithNestedElements(bool) GatherHeadings
Includes nested HTML elements in the heading content (the default is false).
WithNesting(bool) GatherHeadings
Controls whether the heading documents are nested. If nesting is used, only the level 1 headings will be in the root set of documents. The rest of the heading documents will only be accessible via the metadata of the root heading documents.

Extension Methods