A module is a small single-purpose component that takes documents as input, does something based on those documents (possibly transforming them), and outputs documents as a result of whatever operation was performed.
Modules in Wyam treat inputs and outputs in different ways. Some modules just "pass-through" the documents that are input, some transform them in some way and output the results, and some exhibit more complex behavior. Some modules even exhibit different behavior depending on how the module was configured. The behavior can get especially confusing when considering some modules evaluate child modules which also output documents. In these cases, there are different behaviors for how the input documents and the result documents from the child modules are combined. The way inputs, outputs, and child module results are related can generally be described as a few different patterns and even though these probably don't cover the way every module works, they should help you understand the concepts involved.
Pass-Through
These modules just take the input documents and pass them on as the outputs:
Transformation
These modules apply some sort of transformation to the input documents and output one result for each input:
Aggregation
These modules take multiple input documents and combine them into a single output document:
Splitting
This is the opposite behavior of aggregation. These modules split each input document into multiple output documents:
Concatenation
In this case, output documents that are independent from the input documents are output, but instead of replacing the input document they are concatenated with them:
Note that the new documents may come from a sequence of child modules:
Replacement
These modules just replace the entire input set of documents with a different output set:
Note that the new documents may come from a sequence of child modules:
Further, some modules support a ForEachDocument()
method that runs the entire set of child modules for each input document:
Combination
This pattern describes the combination of one or more input documents with the outputs from child modules:
As described above, some modules support a ForEachDocument()
method that runs the entire set of child modules for each input document: