Comments (3)
The idea is to allow a sequence of modules to execute without impacting the "main" module sequence. In other words, Branch executes it's child modules as if there were no Branch module in the sequence, but then when it's child modules are done, the main sequence of modules is executed as if there were no Branch. I'm not sure either of those explanations made a ton of sense, so it's probably best explained with an example. Assume you have a module, AddOne, that just adds 1 to whatever numeric value is in the content of the input document(s). The input and output content of the following configuration should demonstrate what Branch does:
// Input Content // Output Content
Pipelines.Add(
AddOne(), // [Empty] // 0
AddOne(), // 0 // 1
AddOne(), // 1 // 2
Branch(
AddOne(), // 2 // 3
AddOne() // 3 // 4
),
AddOne(), // 2 // 3
AddOne() // 3 // 4
);
You can see that the input content to the AddOne modules after the Branch is the same as the input content to the AddOne modules inside the branch. The result of the modules in the Branch had no impact on those modules that run after the Branch. This is true for both content and metadata. If any modules inside the Branch created or changed metadata, it would be forgotten once the Branch was done.
Now, why would you need this? There are a couple of use cases I can think of. One might be if you need to process your input documents multiple different ways. Branch would let you keep the input content to each transformation the same. Another case might be if you want to write the documents to disk multiple times but don't want to preserve the metadata that WriteFiles adds from one write to the next.
from wyam.web.
Thank you for the explanation. This explanation I think should go to the documentation because it clearly describes the purpose of http://wyam.io/modules/branch.
from wyam.web.
Good point - done.
from wyam.web.
Related Issues (20)
- Bad markdown code syntax HOT 2
- Can't get CSS to render locally HOT 4
- GitHub URL is case sensitive HOT 3
- Better document relationship between input, output, and root paths
- Add KB article on module input/output behavior and multiplicity
- Add KB article on tools package
- 404 https://wyam.io/modules/searchindex HOT 3
- the build is red HOT 2
- Incorrect command line example for using the Solid State blog theme HOT 1
- Explain extensionless behavior in getting started HOT 1
- Make text links more visible HOT 1
- Recipe docs have copy/paste typos
- Details how to set Keys from the CLI would be helpful HOT 1
- Showroom in wyam.io HOT 2
- Add Chocolatey to installation. HOT 1
- Mardown table not well rendered
- Globbing engine syntax documentation example possible error HOT 1
- Website errors HOT 4
- Improv hero link
- AutoLinkTypes docs theme setting is slightly confusing
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wyam.web.