#

# About CWEB

Please read the following carefully if you plan to use cweb in Leo.

Cweb mode refers to how Leo tangles an outline when @language cweb is in effect or the cweb option in the Preferences Panel is in effect. Like noweb, cweb defines sections and uses section references. Cweb sections start with @<name@>= and cweb section references look like @<name@>

Warning: Please do not use cweb mode in @root trees until version 3.9. At present, Leo attempts to expand cweb sections, and that won't work at all unless you make major changes to the cweb code.

Leo treats cweb code in cweb mode as unevaluated text. That is, Leo treats cweb section definitions, section references, and the @c and @space directives as "raw" text within cweb mode. Leo does not expand cweb section references when writing derived files in cweb mode. However, Leo does expand noweb section references, so you may use noweb sections to organize cweb files! You can create noweb code and doc sections using the @code and @doc directives in place of @c and @space directives.

There are several advantages of this scheme:

1. Leo does not have to try to duplicate cweb's way of tangling. Instead, Leo simply outputs .w files to be tangled by the "real" cweb. In particular, Leo need not deal with @d, @x, @y, or @z control codes (or any other control codes) in any special manner.
2. You need make no changes to your cweb code in order to organize cweb code.
3. You can use noweb sections, and all of Leo's directives, including the @others directive, to organize cweb code.

This way of handling cweb mode applies to version 3.8 and all later versions. In version 3.9, Leo will handle cweb mode in @root trees in the same way. However, it will probably always be more convenient to use @file trees than @root trees in cweb mode.