A Noweb input text contains program source code interleaved with documentation. It consists of so-called
chunks that are either
documentation chunks or
code chunks. A documentation chunk begins with a line that starts with an
at sign (@) followed by a space or
newline. A documentation chunk has no name. Documentation chunks normally contain LaTeX, but Noweb is also used with HTML, plain TeX, and troff. Code chunks are named. A code chunk begins with >= on a line by itself. The double left angle bracket ( \section{Hello world} Today I awoke and decided to write some code, so I started to write Hello World in \textsf C. >= /* > • / • include int main(int argc, char *argv[]) { printf("Hello World!\n"); return 0; } @ \noindent \ldots then I did the same in PHP. >= > */ echo "Hello world!\n"; ?> @ \section{License} Later the same day some lawyer reminded me about licenses. So, here it is: >= This work is placed in the public domain. Assuming that the above code is placed in a file named 'hello.nw', the command to extract the human-readable document in
HTML format is: noweave -filter l2h -index -html hello.nw | htmltoc > hello.html ... and in
LaTeX format: noweave -index -latex hello.nw > hello.tex To extract machine source code: notangle -R hello.c hello.nw > hello.c notangle -R hello.php hello.nw > hello.php ==Compatibility==