@@ -104,10 +104,11 @@ These entities can be used in the MAN page and the User manual.
104104Note that the four type tags themselves (``<tool> ``, ``<builder> ``,
105105``<cvar> `` and ``<function> ``) can only be used in documentation
106106sources in the ``SCons `` directory; the build will not scan for these
107- in the ``doc `` directory.
107+ tags in files in the ``doc `` directory.
108108
109- When you add an XML file in the ``SCons/Tools `` folder, e.g. for
110- a tool named ``foobar ``, you can use the two entities
109+ When you add tool documentation using the ``<tool> `` tag,
110+ let's say for a tool named ``foobar ``, you can use the two
111+ automatically generated entities
111112
112113*t-foobar *
113114 which prints the name of the Tool, and
@@ -118,6 +119,10 @@ a tool named ``foobar``, you can use the two entities
118119The link will be to the appropriate Appendix in the User Guide,
119120or to the proper section in the manpage.
120121
122+ The ``<builder> `` tag similarly generates entities with the *b- * prefix,
123+ the ``<function> `` tag generates entities with the *f- * prefix,
124+ and the ``<cvar> `` tag generates entities with the *cv- * prefix.
125+
121126In the case of Functions, there may be pairs of these, depending
122127on the value of the signature attribute: this attribute tells
123128whether only the global function form, or only the environment
@@ -201,6 +206,47 @@ to write it all in text, as in *See the manpage section
201206"Builder Objects" * than to leave a dangling reference in one
202207of the docs.
203208
209+ Context
210+ =======
211+ While it is very convenient to document related
212+ things together in one xml file, and this is encouraged
213+ as it helps writers keep things in sync,
214+ be aware the information recorded inside the four special tags
215+ will not be presented together in the output documents.
216+ For example, when documenting a Tool in
217+ ``SCons/Tool/newtool.xml `` using the ``<tool> `` tag,
218+ and noting that the tool ``<uses> `` or ``<sets> ``
219+ certain construction variables,
220+ those construction variables can be documented
221+ right there as well using ``<cvar> `` tags.
222+ When processed with ``SConsDoc `` module,
223+ this will generate xml from the
224+ ``<tool> `` tag into the ``tools.{gen,mod} `` files,
225+ and xml from the ``<cvar> `` tag into
226+ the ``variables.{gen,mod} `` files;
227+ those files are then included each into their own
228+ section, so the entries may end up separated by
229+ hundreds of lines in the final output.
230+ The special entries will also be sorted in their
231+ own sections, which might cause two entries using the
232+ same tag in the same source file to be separated.
233+ All this to say: do not write your doc text
234+ with the idea that the locality you see in the xml source file
235+ will be preserved when consumed in a web browser,
236+ manpage viewer, PDF file, etc. Provide sufficient context
237+ so entries can stand on their own.
238+
239+ Another quirk is that ``SConsDoc ``
240+ will take all occurrences of a special tag and
241+ combine those contents into a single entry in the generated file.
242+ As such, normally there should be only one definition of
243+ each element project-wide. This particularly comes up in tool definitions,
244+ as several tools may refer to the same construction variable.
245+ It is suggested to pick one file to write the documentation in,
246+ and then in the other tool documents referencing it,
247+ place a comment indicating which file the variable is documented in -
248+ this will keep future editors from having to hunt too far for it.
249+
204250SCons Examples
205251==============
206252
@@ -224,7 +270,7 @@ Before this script starts to generate any output, it checks whether the
224270names of all defined examples are unique. Another important prerequisite
225271is that for every example all the single ``scons_output `` blocks need
226272to have a ``suffix `` attribute defined. These suffixes also have to be
227- unique, within each example.
273+ unique, within each example, as this controls the ordering .
228274
229275All example output files (``*.xml ``) get written to the folder
230276``doc/generated/examples ``, together with all files defined via the
@@ -235,6 +281,11 @@ changes in the outputs after editing the docs:
235281::
236282 git diff doc/generated/examples
237283
284+ Some of the changes in example text are phony: despite best
285+ efforts to eliminate system-specifics, sometimes they leak through.
286+ There is at least one example that gets the pathname to the
287+ build directory of the machine the example is generated on.
288+
238289Note that these output files are not actually needed for editing the
239290documents. When loading the User manual into an XML editor, you will
240291always see the example's definition. Only when you create some output,
0 commit comments