Execute

Executes custom code that returns documents, modules, or new content.
This module is very useful for customizing pipeline execution without having to write an entire module. Returning modules from the delegate is also useful for customizing existing modules based on the current set of documents. For example, you can use this module to execute the Wyam.Core.Modules.Contents.Replace module with customized search strings based on the results of other pipelines.

Usage

  • Execute(Action<IDocument, IExecutionContext> execute, bool parallel = true)

    Specifies a delegate that should be invoked once for each input document. The output from this module will be the input documents.

    • execute

      An action to execute on each input document.

    • parallel

      The delegate is usually evaluated and each input document is processed in parallel. Setting this to false runs evaluates and processes each document in their original input order.

  • Execute(Action<IExecutionContext> execute)

    Specifies a delegate that should be invoked once for all input documents. The output from this module will be the input documents.

    • execute

      An action to execute.

  • Execute(ContextConfig execute)

    Specifies a delegate that should be invoked once for all input documents. If the delegate returns a IEnumerable<IDocument> or Wyam.Common.Documents.IDocument, the document(s) will be the output(s) of this module. If the delegate returns a IEnumerable<IModule> or Wyam.Common.Modules.IModule, the module(s) will be executed with the input documents as their input and the results will be the output of this module. If the delegate returns null, this module will just output the input documents. If anything else is returned, an exception will be thrown.

    • execute

      A delegate to invoke that should return a IEnumerable<IDocument>, Wyam.Common.Documents.IDocument, IEnumerable<IModule>, Wyam.Common.Modules.IModule, or null.

  • Execute(DocumentConfig execute, bool parallel = true)

    Specifies a delegate that should be invoked once for each input document. If the delegate returns a IEnumerable<IDocument> or Wyam.Common.Documents.IDocument, the document(s) will be the output(s) of this module. If the delegate returns a IEnumerable<IModule> or Wyam.Common.Modules.IModule, the module(s) will be executed with each input document as their input and the results will be the output of this module. If the delegate returns null, this module will just output the input document. If anything else is returned, the input document will be output with the string value of the delegate result as it's content.

    • execute

      A delegate to invoke that should return a IEnumerable<IDocument>, Wyam.Common.Documents.IDocument, IEnumerable<IModule>, Wyam.Common.Modules.IModule, object, or null.

    • parallel

      The delegate is usually evaluated and each input document is processed in parallel. Setting this to false runs evaluates and processes each document in their original input order.

GitHub