Documents

Inserts documents into the current pipeline.
Documents can be inserted either by replacing pipeline documents with previously processed ones or by creating new ones. If getting previously processed documents from another pipeline, this module copies the documents and places them into the current pipeline. Note that because this module does not remove the documents from their original pipeline it's likely you will end up with documents that have the same content and metadata in two different pipelines. This module does not include the input documents as part of it's output. If you want to concatenate the result of this module with the input documents, wrap it with the Wyam.Core.Modules.Control.Concat module.

Usage

  • Documents()

    This outputs all existing documents from all pipelines (except the current one).

  • Documents(ContextConfig documents)

    This will get documents based on the context so you can perform custom document fetching behavior. The delegate will only be called once, regardless of the number of input documents. The return value is expected to be a IEnumerable<IDocument>.

    • documents

      A delegate that should return a IEnumerable<IDocument> containing the documents to output.

  • Documents(DocumentConfig documents)

    This will get documents based on each input document. The output will be the aggregate of all returned documents for each input document. The return value is expected to be a IEnumerable<IDocument>.

    • documents

      A delegate that should return a IEnumerable<IDocument> containing the documents to output for each input document.

  • Documents(params IEnumerable<KeyValuePair<string, object>>[] metadata)

    Generates new documents with the specified metadata.

    • metadata

      The metadata for each output document.

  • Documents(int count)

    Generates a specified number of new empty documents.

    • count

      The number of new documents to output.

  • Documents(string pipeline)

    This outputs the documents from the specified pipeline.

    • pipeline

      The pipeline to output documents from.

  • Documents(params string[] content)

    Generates new documents with the specified content.

    • content

      The content for each output document.

  • Documents(params Tuple<string, IEnumerable<KeyValuePair<string, object>>>[] contentAndMetadata)

    Generates new documents with the specified content and metadata.

    • contentAndMetadata

      The content and metadata for each output document.

Fluent Methods

Chain these methods together after the constructor to modify behavior.

  • FromPipelines(params string[] pipelines)

    Gets documents from additional pipeline(s). The final sequence of documents will be in the order they appear from all specified pipelines. If the empty constructor is used that outputs documents from all pipelines, this will override that behavior and only output the specified pipelines. Likewise, if another constructor was used that relies on a Wyam.Common.Configuration.ContextConfig or Wyam.Common.Configuration.DocumentConfig then using this method will throw System.InvalidOperationException.

    • pipelines

      The additional pipelines to get documents from.

  • Where(DocumentConfig predicate)

    Only documents that satisfy the predicate will be output.

    • predicate

      A delegate that should return a bool.

GitHub