While processing the input file, the following variable indicates whether a code chunk has been detected. Its value is set to 1 by entering a code chunk and reset to 0 by leaving the chunk.
Verbatim environments are left untouched by this script. For aldordoc, a verbatim environemt is a LATEX environment whose name contains the string verbatim. On entry into such an environment, the following variable is set to the actual name of the environment. The end of the environment is recognized by \end{VERBNAME} where VERBNAME is the current value of the following variable. Outside a verbatim environment the value of this variable is the empty string.
Another type of environments that are treated in an almost verbatim fashion are code environments. They represent pieces (snippets) of Aldor code inside documentation. The following variable is treated in exactly the same way as the variable inVerbatim above.
The first content line of an adsnippet-like environment determines how many initial spaces will be removed from the environment. The value is initially set to −1. After the first line has been investigated its value should reflect the number of initial spaces that can be removed from any line.
Basically, the text inside the environment should appear in almost verbatim form. The only difference is that aldordoc active commands are executed inside adsnippet-like environments, i. e., the output of such environments may contain hyperlinks. The function adtranslateAdsnippetText takes care of the active commands.
After every line of the content of an adusage or adsnippet environment (except the last one) we add code (\mbox{}\\) in order to start a new line. We, therefore, first collect the lines into the Perl array snippetContents and then join the lines with the above code as a delimiter and, of course, a newline.