Replaces occurrences of specified strings with HTML links.
- Namespace
- Statiq
.Core - Interfaces
- Base Types
-
- object
- Module
- ParallelModule
graph BT
Type-->Base0["ParallelModule"]
click Base0 "/api/Statiq.Common/ParallelModule"
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["InsertLinks"]
class Type type-node
Syntax
public class InsertLinks : ParallelModule, IModule, IParallelModule
Remarks
This module is smart enough to only look in specified HTML elements (p by default). You can supply an alternate query selector to narrow the search scope to different container elements or to those elements that contain (or don't contain) a CSS class, etc. It also won't generate an HTML link if the replacement text is already found in another link.
Note that because this module parses the document content as standards-compliant HTML and outputs the formatted post-parsed DOM, you should only place this module after all other template processing has been performed.
Constructors
Name | Summary |
---|---|
InsertLinks |
Creates the module without any initial mappings. Use AddLink(...) to add mappings with fluent methods.
|
InsertLinks |
Specifies a dictionary of link mappings given an IDocument and IExecutionContext . The return
value is expected to be a IDictionary<string, string> . The keys specify strings to search for in the
HTML content and the values specify what should be placed in the href attribute. This allows you
to specify a different mapping for each input document.
|
Properties
Name | Property Type | Summary |
---|---|---|
Parallel | bool |
Indicates whether documents will be
processed by this module in parallel.
Inherited from ParallelModule
|
Methods
Name | Return Value | Summary |
---|---|---|
AfterExecution |
void |
Called after each module execution.
Inherited from Module
|
AfterExecutionAsync |
Task |
Called after each module execution.
Inherited from Module
|
BeforeExecution |
void |
Called before each module execution.
Inherited from Module
|
BeforeExecutionAsync |
Task |
Called before each module execution.
Inherited from Module
|
ExecuteAsync |
Task |
This should not be called directly, instead call
IExecutionContext.Execute() if you need to execute a module from within another module.
Inherited from Module
|
ExecuteContextAsync |
Task |
Executes the module once for all input documents.
Inherited from ParallelModule
|
ExecuteInputAsync |
Task |
|
Finally |
void |
Called after each module execution, even if an exception is thrown during execution.
Inherited from Module
|
FinallyAsync |
Task |
Called after each module execution, even if an exception is thrown during execution.
Inherited from Module
|
With |
InsertLinks |
Adds additional end word separator characters when limiting matches to whole words only.
These additional characters are in addition to the default of splitting words at white space.
|
WithLink |
InsertLinks |
Adds an additional link to the mapping. This can be used whether or not you specify a mapping in the constructor.
|
With |
InsertLinks |
Forces the string search to only consider whole words (it will not add a link in the middle of a word).
By default whole words are determined by testing for white space.
|
WithQuerySelector |
InsertLinks |
Allows you to specify an alternate query selector.
|
With |
InsertLinks |
Adds additional start word separator characters when limiting matches to whole words only.
These additional characters are in addition to the default of splitting words at white space.
|
WithWordSeparators |
InsertLinks |
Adds additional word separator characters when limiting matches to whole words only.
These additional characters are in addition to the default of splitting words at white space.
|