3 # Some internal information on how the documentation is generated. All
4 # this is quite a mess, the complete documentation generation setup is
5 # in dire need of a complete redesign, but ...
8 # The documentation generation process is tightly integrated with the
9 # scons build framework:
11 # * SCons analyzes the Doxyfile's to find all the documentation
12 # dependencies. This happens in the doxygen builder in
13 # senfscons/Doxygen.py.
15 # * possibly the doclib/doxy-header.html and/or
16 # doclib/doxy-footer.html files are regenerated
18 # * If any documentation is out-of-date with respect to it's source
19 # files, the documentation is regenerated.
21 # * When building the complete documentation ('all_docs'), the
22 # cross-reference page will be rebuilt if necessary (The global list
25 # * To fix some link errors, the additional 'linlint' and 'fixlinks'
29 # 1. Scanning the Doxyfile's
31 # The doxygen builder scans all documentation source files which have
32 # the text 'doxyfile' in any case within them. It understands @INCLUDE
33 # directives and will find all the dependencies of the documentation:
35 # * All the source files as selected by INPUT, INPUT_PATTERN,
36 # RECURSIVE and so on.
38 # * Any referenced tag-files
40 # * Documentation header and/or footer
42 # * The INPUT_FILTER program
44 # * Any included doxygen configuration files
47 # 2. Regenerating header and/or footer
49 # If needed, the doxy-header.html and/or doxy-footer.html file will be
50 # regenerated. The dependencies are *not* complete, just adding a new
51 # subdirectory sadly does not automatically update the header (which
54 # The header and/or footer are written are generated from templates
55 # using a simple python based templating system called yaptu which is
56 # included in doclib/.
61 # The doxygen call itself is quite complex since there is some pre-
62 # and post-processing going on. We can separate this step into tree
65 # * Building prerequisites (e.g. images)
67 # * The processing done by the Doxygen builder
69 # * Additional processing added by the SENFSCons.Doxygen helper.
72 # 3.1. Building prerequisites
74 # The prerequisites are images referenced by the documentation. These
75 # images are mostly generated using the Dia2Png builder.
78 # 3.2. The main doxygen build (Doxygen builder)
80 # * doxygen proper is called
82 # * doxygen is configured in Doxyfile.global to call
83 # 'doclib/filter.pl' on each source file. This filter will strip
84 # excess whitespace from the beginning of lines in '\code' and
85 # '<pre>' blocks. Additionally it will expand all tabs, tab width is
86 # 8 spaces (there should be no tabs in the source but ...)
88 # * doxygen is configured in Doxyfile.global to call 'doclib/dot' to
89 # generate the 'dot' images.
91 # * 'doclib/dot' calls 'doclib/dot-munge.pl' on the .dot
92 # files. dot-munge.pl changes the font and font-size and adds
93 # line-breaks to long labels
95 # * 'doclib/dot' calls the real dot binary. If the resulting image is
96 # more than 800 pixels wide, dot is called again, this time using
97 # the oposite rang direction (top-bottom vs. left-right). Then the
98 # image with the smaller width is selected and returned.
100 # * after doxygen is finished, the list of referenced tag-files is
101 # checked. For each tag file the directory is found, where the
102 # documentation is generated (by scanning the Doxyfile which is
103 # repsonsible for building the tag file). For every tag file, the
104 # correct 'insstalldox' command is generated
106 # * The stamp files are created
109 # 3.3. Postprocessing
111 # The following steps are mostly added to work around some stupid
114 # * If a tag file is generated, 'senfscons/tagmunge.xsl' is called on the
115 # tag file. This XSLT stylesheet removes all namespace components
116 # from the tag file. Without this task, doxygen will completely barf
117 # when two different documentation parts have members in the same
120 # * All html files are processed by 'doclib/html-munge.xsl'. However,
121 # since the documentation generated by doxygen is completely broken
122 # we need to preprocess the html files with a simple 'sed' script
123 # and 'tidy' before 'xsltproc' even accepts the html code.
125 # * We use the generated xml output of doxygen to generate an XML
126 # fragment for the global cross reference. This fragment is
127 # generated by 'senfscons/xrefxtract.xslt'
130 # 4. Building the global cross-reference
132 # The global cross reference is built from the cross-refernce
133 # fragments generated for each of the documentation parts and from the
134 # doxy-header.html/doxy-footer.html files. This conversion is
135 # controlled by the 'senfscons/xrefhtml.xslt' stylesheet.
138 # 5. Fixing broken links
140 # After the documentation has been generated, additional calls first
141 # to the 'linklint' and then to the 'fixlinks' target will try to fix
142 # broken links generated by doxygen. First, 'linklint' will call the
143 # linklint tool to check for broken links in the documentation.
145 # 'fixlinks' is then called which calls 'doclib/fixlinks.py' which
146 # scans *all* html files, builds an index of all (unique) anchors and
147 # then fixes the url part of all links with correct anchor but bad
155 ###########################################################################
160 # Naja ... etwas rumgehackt aber was solls ...
163 pathbase = len(env.Dir('#').abspath)+1
164 for module in env.Alias('all_docs')[0].sources:
165 if module.name != 'html.stamp' : continue
166 mods[module.dir.dir.dir.abspath] = [ module.dir.dir.dir.name,
167 module.dir.abspath[pathbase:],
176 if len(rv[i]) > pathbase and mod.startswith(rv[i] + '/'):
177 level = mods[rv[i]][2] + 1
179 while i < len(rv) and mods[rv[i]][2] >= level:
189 if mods[mod][2] == 0:
190 mods[mod][0] = 'lib' + mods[mod][0]
193 for name,path in EXTRA_MODULES:
194 path = env.Dir(path).dir.dir.abspath
198 mods[rv[i]][0] = name
200 while i+m < len(rv) and mods[rv[i+m]][2] > mods[rv[i]][2]:
209 return ( tuple(mods[mod]) for mod in rv )
212 ix = len(env.Dir('#').abspath)+1
213 return [ doc.dir.abspath[ix:]
214 for doc in env.Alias('all_docs')[0].sources
215 if doc.name == "search.idx" ]
217 def writeTemplate(target = None, source = None, env = None):
218 file(target[0].abspath,"w").write(yaptu.process(str(env['TEMPLATE']), globals(), env.Dictionary()))
220 writeTemplate = env.Action(writeTemplate, varlist = [ 'TEMPLATE' ])
222 ###########################################################################
224 # Extra documentation modules which are handled (named) different from
227 ('Overview', '#/doc/html'),
228 ('Examples', '#/Examples/doc/html'),
229 ('HowTos', '#/HowTos/doc/html'),
230 ('SENFSCons', '#/senfscons/doc/html') ]
232 HEADER = """<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
235 <title>$title</title>
236 <link href="@TOPDIR@/doc/html/doxygen.css" rel="stylesheet" type="text/css">
237 <link href="@TOPDIR@/doclib/senf.css" rel="stylesheet" type="text/css">
238 <link rel="shortcut icon" href="@TOPDIR@/doclib/favicon.ico">
239 <style type="text/css">
240 div.tabs li.$projectname a { background-color: #EDE497; }
249 <form action="@TOPDIR@/doclib/search.php" method="get">
250 Search: <input type="text" name="query" size="20" accesskey="s"/>
253 <h1>SENF Extensible Network Framework</h1>
258 <li><a href="@TOPDIR@/doc/html/xref.html">Open Issues</a></li>
259 <li><a class="ext" href="http://developer.berlios.de/bugs/?group_id=7489">Bug Tracker</a></li>
260 <li><a class="ext" href="http://svn.berlios.de/viewcvs/senf/trunk/">Browse SVN</a></li>
261 <li><a class="ext" href="http://svn.berlios.de/wsvn/senf/?op=log&rev=0&sc=0&isdir=1">ChangeLog</a></li>
262 <li><a class="ext" href="http://developer.berlios.de/projects/senf">BerliOS</a></li>
263 <li><a class="ext" href="http://openfacts.berlios.de/index-en.phtml?title=SENF+Network+Framework">Wiki</a></li>
264 <li><a href="@TOPDIR@/doc/html/index.html">Home</a></li>
272 <div class="tabs menu">
274 {{ for name, path, level in modules():
275 <li class="${name} level${level}"><a href="@TOPDIR@/${path}/index.html">${name}</a></li>
277 <li class="glossary level0"><a href="@TOPDIR@/doc/html/glossary.html">Glossary</a></li>
281 FOOTER = """<hr style="width:0px;border:none;clear:both;margin:0;padding:0" />
286 <a href="mailto:senf-dev@lists.berlios.de">Contact: senf-dev@lists.berlios.de</a> |
287 Copyright © 2006 Fraunhofer Gesellschaft, SatCom, Stefan Bund
293 <?php include 'search_functions.php'; ?>
294 <?php search(); ?>"""
296 SEARCH_PATHS_PHP="""<?php
299 {{ for index in indices():
306 env.Command('doxy-header.html', 'SConscript', writeTemplate,
307 TEMPLATE = Literal(HEADER),
308 TITLE = "Documentation and API reference")
309 env.Command('doxy-footer.html', 'SConscript', writeTemplate,
310 TEMPLATE = Literal(FOOTER))
311 env.Alias('all_docs',
312 env.Command('search.php', [ 'html-munge.xsl', 'SConscript' ],
314 'xsltproc --nonet --html --stringparam topdir .. -o - $SOURCE $TARGET 2>/dev/null'
316 + r" -e 's/\[\[/<?/g' -e 's/\]\]/?>/g'"
317 + r" -e 's/\$$projectname/Overview/g'"
318 + r" -e 's/\$$title/Search results/g'"
319 + "> ${TARGETS[0]}.tmp",
320 'mv ${TARGET}.tmp ${TARGET}' ],
321 TEMPLATE = Literal(HEADER
322 + SEARCH_PHP.replace('<?','[[').replace('?>',']]')
324 TITLE = "Search results"))
325 env.Alias('all_docs',
326 env.Command('search_paths.php', 'SConscript', writeTemplate,
327 TEMPLATE = Literal(SEARCH_PATHS_PHP)))
329 env.Alias('install_all',
330 env.Install( '$DOCINSTALLDIR/doclib', [ 'favicon.ico',
333 'search_functions.php',
337 env.Clean('all', 'doxy-header.html') # I should not need this but I do ...
338 env.Clean('all_docs', 'doxy-header.html') # I should not need this but I do ...