Example 1, write code as a series of blocks
One of the tenants of literate programing is the ability to write prose then generate code. mweae uses Markdown's code blocks for that.
/** * example-1.js */ /*jslint node: true, indent: 4 */
In this block I just setup a command header and a jslint directive.
console.log("Caculating 1 + 1"); var accumulator = 0; accumulator = 1 + 1;
Now that we done a caculation let us send that to the console.
console.log("And the answer is", accumulator);
Finally let us tell the viewer we are done.
console.log("All done!"); process.exit(0);
Running this through mweave should produce a single file called example-1.js