This page tell how to turn (parts of) an outline into the text files, so you can use Leo to create computer programs or other text documents, including html and xml documents.

Leo can automatically generate external files from parts of an outline. A single .leo file can generate many separate text files. Headlines such as the following tell Leo to read and write the corresponding external file when reading or writing the Leo outline:

@auto <filename>
@file <filename>
@shadow <filename>
@thin <filename>

Collectively, these headline directives are known as @<file> directives. There are other @<file> directives not listed above, but we won't discuss them in this tutorial.

The @file and @thin directives create external files. You could say that the Leo outline "owns" those files. Leo inserts sentinel comments in files created with @file and @thin. This allows Leo to store information that makes managing the files easier, and allows @file and @thin outlines to have features that are not possible with @auto and @shadow.

The @auto and @shadow directives manage imported external files. When reading an .leo file, Leo parses @auto and @shadow files. When writing @auto and @shadow files, Leo writes those files without sentinels. Thus, you can use @auto and @shadow to manage files owned by others.

To be revised...

Each file that is to be created has a sub=outline headed by one of the @<file> directives that specifies the filename to be created/updated. The sub- outline of the @<file> containing headline is the source of all the text that will end up in the file, but just how is the hierarchically organized text converted into a linear one? To convey this process, lets use a mechanical analogy of assembling a paper based 'scroll' of the file's text.

First, you should be aware that headlines are not part of the information that matters to whatever program is going to deal with the output file, so they are not put in the relevant text of the output, (they may end up in comments, but that is covered below). For this assembly process, headlines only possible use is as labels that name the text that will be used to replace that labels occurence in the bodytext of one of its parents. Such labels are denoted by being quoted by double angles, e.g. <<label>>, when these occur in bodytext, they indicate the place at which their defining text is to be pasted, when they occur in a headline, the indicate that that nodes bodytext is to be used as the 'boilerplate text' for the replacement of any occurrence of the label in one of its parents. Any headline that is not a 'label' exists strictly to flesh out the division of the outline.

Thus far, the only text that will get picked up is the bodytext of the @<file> node, with any <<labels>> it contains replaced with the bodytext of the first child node that defines that label. Any label definition can extend this by having labels in its bodytext that is then defined in one of its child nodes. There is another mechanism to indicate that child node's text is to be pick up and placed in the output file, that is the occurrence of the directive "@others" in either the initial @<file> node or the definition of a used <<label>>. The '@others' directive signals that the bodytext of all the non label-defining children is to be picked up and pasted in its place.

A note about the pasting in of text, whenever a <<label>> or and @others is replace with the called for text, it is done in a way that preserves the leading space that existed where the <<labe>> or @others was