Using the plugin is relatively simple; the syntax of the source file is identical to that of the original NoWeb (that I can detect). For the purposes of this explanation there is a sample source code here written in Objective-C. The Ant statements to run the noweb plugin are very similar to the Ant task javac.
To produce the code the simplest Ant file would be (assuming the build.xml is in the same folder as the source file):
This would processes all the "*.nw" and "*.noweb" files in the sourceDir folder using the tangle filter and will output the code starting at chunk named "*". Assuming that the source file is called convertInteger.nw the output will be placed in convertInteger.m in the sourceDir folder. Typical output would be
This produces a file convertInteger.m
A similar process is used to process the documentation to TeX or LaTeX:
The output is similar to the tangle process:
This produces a TeX file which can be processed (with the noweb style file available from here with the master distribution) to convertInteger.pdf.
There are several attributes for the Ant task, many based on the javac Ant task, which make the process more versatile than setting a single input file and output file. The following examples are typical.
Tangles all NoWeb files in sourceDir with each output starting at convertInteger. The output is written to the file convertInteger (root overrides everything here). This does not work unless there is only one file to be processed; if there were multiple files they would all overwrite the file convertInteger with the last to be processed being the one written to convertInteger. It is worth noting that because a file extension hasn't been given the task outputs a warning message:
This would make the tangle output fragile as the comments for file, line etc which tangle outputs potentially invalid for the language.
When a source become too big it is usual to split it up into a series of files with a master file including the various parts of the source. Consider a source file diffXML.nw with two included parts, diffXML-0.nw and diffXML-1.nw. The parts are included in the diffXML.nw file using the includeNoweb statement:
The Ant task is
Running this will produce the following output
However, this is not necessarily what we want as the two parts are also tangled. We need to tell the task not to process the part files. We rewrite the build file: