3 # The documentation generation process is tightly integrated with the
4 # scons build framework:
6 # * SCons analyzes the Doxyfile's to find all the documentation
7 # dependencies. This happens in the doxygen builder in
8 # senfscons/Doxygen.py.
10 # * the doclib/doxy-header.html and/or doclib/doxy-footer.html files
13 # * If any documentation is out-of-date with respect to it's source
14 # files, the documentation is regenerated.
16 # * To fix some link errors, the additional 'linklint' and 'fixlinks'
20 # 1. Scanning the Doxyfile's
22 # The doxygen builder scans all documentation source files which have
23 # the text 'doxyfile' in any case in their name. It understands
24 # @INCLUDE directives and will find all the dependencies of the
27 # * All the source files as selected by INPUT, INPUT_PATTERN,
28 # RECURSIVE and so on.
30 # * Any referenced tag-files
32 # * Documentation header and/or footer
34 # * The INPUT_FILTER program
36 # * Any included doxygen configuration files
39 # 2. Regenerating header and/or footer
41 # If needed, the doxy-header.html and/or doxy-footer.html file will be
42 # regenerated. The dependencies are *not* complete, just adding a new
43 # subdirectory sadly does not automatically update the header (which
46 # The header and/or footer are written are generated from templates
47 # using a simple python based templating system called yaptu which is
48 # included in doclib/.
53 # The doxygen call itself is quite complex since there is some pre-
54 # and post-processing going on. We can separate this step into two
57 # * Building prerequisites (e.g. images)
59 # * The processing done by the Doxygen builder and doclib/doxygen.sh
62 # 3.1. Building prerequisites
64 # The prerequisites are images referenced by the documentation. These
65 # images are mostly generated using the Dia2Png builder.
68 # 3.2. The main doxygen build (Doxygen builder)
70 # The Doxygen builder will call the doxygen command to build the
73 # The doxygen command is configured as 'doclib/doxygen.sh' which
74 # does some additional processing in addition to calling doxygen
77 # * it sets environment variables depending on command line arguments.
78 # These variables are then used in the Doxyfile's
80 # * after doxygen is finished, 'installdox' is called to resolve
81 # tag file references.
83 # * the HTML documentation is post-processed using some sed, tidy, and
86 # * a generated tag file is post-processed using an XSLT template
88 # (see doclib/doxygen.sh for more information). The Doxygen
89 # configuration is set up such, that
91 # * doxygen calls 'doclib/filter.pl' on each source file. This filter
92 # will strip excess whitespace from the beginning of lines in
93 # '\code' and '<pre>' blocks. Additionally it will expand all tabs,
94 # tab width is 8 spaces (there should be no tabs in the source but
97 # * doxygen calls 'doclib/dot' to generate the 'dot' images.
99 # * 'doclib/dot' calls 'doclib/dot-munge.pl' on the .dot
100 # files. dot-munge.pl changes the font and font-size and adds
101 # line-breaks to long labels
103 # * 'doclib/dot' calls the real dot binary. If the resulting image is
104 # more than 800 pixels wide, dot is called again, this time using
105 # the oposite rank direction (top-bottom vs. left-right). The image
106 # with the smaller width is selected and returned.
109 # 4. Fixing broken links
111 # After the documentation has been generated, additional calls first
112 # to the 'linklint' and then to the 'fixlinks' target will try to fix
113 # broken links generated by doxygen. First, 'linklint' will call the
114 # linklint tool to check for broken links in the documentation.
116 # 'fixlinks' is then called which calls 'doclib/fixlinks.py' which
117 # scans *all* html files, builds an index of all (unique) anchors and
118 # then fixes the url part of all links with correct anchor but bad
126 ###########################################################################
131 # Naja ... etwas rumgehackt aber was solls ...
134 pathbase = len(env.Dir('#').abspath)+1
135 for module in env.Alias('all_docs')[0].sources:
136 if module.name != 'html.stamp' : continue
137 mods[module.dir.dir.dir.abspath] = [ module.dir.dir.dir.name,
138 module.dir.abspath[pathbase:],
147 if len(rv[i]) > pathbase and mod.startswith(rv[i] + '/'):
148 level = mods[rv[i]][2] + 1
150 while i < len(rv) and mods[rv[i]][2] >= level:
160 if mods[mod][2] == 0:
161 mods[mod][0] = 'lib' + mods[mod][0]
164 for name,path in EXTRA_MODULES:
165 path = env.Dir(path).dir.dir.abspath
169 mods[rv[i]][0] = name
171 while i+m < len(rv) and mods[rv[i+m]][2] > mods[rv[i]][2]:
180 return ( tuple(mods[mod]) for mod in rv )
183 ix = len(env.Dir('#').abspath)+1
184 return [ doc.dir.abspath[ix:]
185 for doc in env.Alias('all_docs')[0].sources
186 if doc.name == "search.idx" ]
188 def writeTemplate(target = None, source = None, env = None):
189 file(target[0].abspath,"w").write(yaptu.process(str(env['TEMPLATE']), globals(), env.Dictionary()))
191 writeTemplate = env.Action(writeTemplate, varlist = [ 'TEMPLATE' ])
193 ###########################################################################
195 # Extra documentation modules which are handled (named) different from
198 ('Overview', '#/doc/html'),
199 ('Examples', '#/Examples/doc/html'),
200 ('HowTos', '#/HowTos/doc/html'),
201 ('SENFSCons', '#/senfscons/doc/html') ]
203 HEADER = """<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
206 <title>$title</title>
207 <link href="@TOPDIR@/doc/html/doxygen.css" rel="stylesheet" type="text/css">
208 <link href="@TOPDIR@/doclib/senf.css" rel="stylesheet" type="text/css">
209 <link rel="shortcut icon" href="@TOPDIR@/doclib/favicon.ico">
210 <style type="text/css">
211 div.tabs li.$projectname a { background-color: #EDE497; }
220 <form action="@TOPDIR@/doclib/search.php" method="get">
221 Search: <input type="text" name="query" size="20" accesskey="s"/>
224 <h1>SENF Extensible Network Framework</h1>
229 <li><a href="@TOPDIR@/doc/html/index.html">Home</a></li>
230 <li><a class="ext" href="http://satext.fokus.fraunhofer.de/senf/debian">Download</a></li>
231 <li><a class="ext" href="http://openfacts2.berlios.de/wikien/index.php/BerliosProject:SENF_Network_Framework">Wiki</a></li>
232 <li><a class="ext" href="http://developer.berlios.de/projects/senf">BerliOS</a></li>
233 <li><a class="ext" href="http://svn.berlios.de/wsvn/senf/?op=log&rev=0&sc=0&isdir=1">ChangeLog</a></li>
234 <li><a class="ext" href="http://svn.berlios.de/viewcvs/senf/trunk/">Browse SVN</a></li>
235 <li><a class="ext" href="http://developer.berlios.de/bugs/?group_id=7489">Bug Tracker</a></li>
236 <li><a href="@TOPDIR@/doc/html/xref.html">Open Issues</a></li>
243 <div class="tabs menu">
245 {{ for name, path, level in modules():
246 <li class="${name} level${level}"><a href="@TOPDIR@/${path}/index.html">${name}</a></li>
248 <li class="glossary level0"><a href="@TOPDIR@/doc/html/glossary.html">Glossary</a></li>
252 FOOTER = """<hr style="width:0px;border:none;clear:both;margin:0;padding:0" />
257 <a href="mailto:senf-dev@lists.berlios.de">Contact: senf-dev@lists.berlios.de</a> |
258 Copyright © 2006 Fraunhofer Gesellschaft, SatCom, Stefan Bund
264 <?php include 'search_functions.php'; ?>
265 <?php search(); ?>"""
267 SEARCH_PATHS_PHP="""<?php
270 {{ for index in indices():
277 env.Command('doxy-header.html', 'SConscript', writeTemplate,
278 TEMPLATE = Literal(HEADER),
279 TITLE = "Documentation and API reference")
280 env.Command('doxy-footer.html', 'SConscript', writeTemplate,
281 TEMPLATE = Literal(FOOTER))
282 env.Alias('all_docs',
283 env.Command('search.php', [ 'html-munge.xsl', 'SConscript' ],
285 'xsltproc --nonet --html --stringparam topdir .. -o - $SOURCE $TARGET 2>/dev/null'
287 + r" -e 's/\[\[/<?/g' -e 's/\]\]/?>/g'"
288 + r" -e 's/\$$projectname/Overview/g'"
289 + r" -e 's/\$$title/Search results/g'"
290 + "> ${TARGETS[0]}.tmp",
291 'mv ${TARGET}.tmp ${TARGET}' ],
292 TEMPLATE = Literal(HEADER
293 + SEARCH_PHP.replace('<?','[[').replace('?>',']]')
295 TITLE = "Search results"))
296 env.Alias('all_docs',
297 env.Command('search_paths.php', 'SConscript', writeTemplate,
298 TEMPLATE = Literal(SEARCH_PATHS_PHP)))
300 env.Alias('install_all',
301 env.Install( '$DOCINSTALLDIR/doclib', [ 'favicon.ico',
304 'search_functions.php',
308 env.Clean('all', 'doxy-header.html') # I should not need this but I do ...
309 env.Clean('all_docs', 'doxy-header.html') # I should not need this but I do ...