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 in their name. It understands
33 # @INCLUDE directives and will find all the dependencies of the
36 # * All the source files as selected by INPUT, INPUT_PATTERN,
37 # RECURSIVE and so on.
39 # * Any referenced tag-files
41 # * Documentation header and/or footer
43 # * The INPUT_FILTER program
45 # * Any included doxygen configuration files
48 # 2. Regenerating header and/or footer
50 # If needed, the doxy-header.html and/or doxy-footer.html file will be
51 # regenerated. The dependencies are *not* complete, just adding a new
52 # subdirectory sadly does not automatically update the header (which
55 # The header and/or footer are written are generated from templates
56 # using a simple python based templating system called yaptu which is
57 # included in doclib/.
62 # The doxygen call itself is quite complex since there is some pre-
63 # and post-processing going on. We can separate this step into tree
66 # * Building prerequisites (e.g. images)
68 # * The processing done by the Doxygen builder
70 # * Additional processing added by the SENFSCons.Doxygen helper.
73 # 3.1. Building prerequisites
75 # The prerequisites are images referenced by the documentation. These
76 # images are mostly generated using the Dia2Png builder.
79 # 3.2. The main doxygen build (Doxygen builder)
81 # * doxygen proper is called
83 # * doxygen is configured in Doxyfile.global to call
84 # 'doclib/filter.pl' on each source file. This filter will strip
85 # excess whitespace from the beginning of lines in '\code' and
86 # '<pre>' blocks. Additionally it will expand all tabs, tab width is
87 # 8 spaces (there should be no tabs in the source but ...)
89 # * doxygen is configured in Doxyfile.global to call 'doclib/dot' to
90 # generate the 'dot' images.
92 # * 'doclib/dot' calls 'doclib/dot-munge.pl' on the .dot
93 # files. dot-munge.pl changes the font and font-size and adds
94 # line-breaks to long labels
96 # * 'doclib/dot' calls the real dot binary. If the resulting image is
97 # more than 800 pixels wide, dot is called again, this time using
98 # the oposite rank direction (top-bottom vs. left-right). The image
99 # with the smaller width is selected and returned.
101 # * after doxygen is finished, the list of referenced tag-files is
102 # checked. For each tag file the directory is found, where the
103 # documentation is generated (by scanning the Doxyfile which is
104 # repsonsible for building the tag file). For every tag file, the
105 # correct 'installdox' command is generated.
107 # * The stamp files are created
110 # 3.3. Postprocessing
112 # The following steps are mostly added to work around some stupid
115 # * If a tag file is generated, 'senfscons/tagmunge.xsl' is called on the
116 # tag file. This XSLT stylesheet removes all namespace components
117 # from the tag file. Without this task, doxygen will completely barf
118 # when two different documentation parts have members in the same
121 # * All html files are processed by 'doclib/html-munge.xsl'. However,
122 # since the documentation generated by doxygen is completely invalid
123 # html we need to preprocess the html files with a simple 'sed'
124 # script and 'tidy' before 'xsltproc' even accepts the html code.
126 # * We use the generated xml output of doxygen to generate an XML
127 # fragment for the global cross reference. This fragment is
128 # generated by 'senfscons/xrefxtract.xslt'
131 # 4. Building the global cross-reference
133 # The global cross reference is built from the cross-refernce
134 # fragments generated for each of the documentation parts and from the
135 # doxy-header.html/doxy-footer.html files. This conversion is
136 # controlled by the 'senfscons/xrefhtml.xslt' stylesheet.
139 # 5. Fixing broken links
141 # After the documentation has been generated, additional calls first
142 # to the 'linklint' and then to the 'fixlinks' target will try to fix
143 # broken links generated by doxygen. First, 'linklint' will call the
144 # linklint tool to check for broken links in the documentation.
146 # 'fixlinks' is then called which calls 'doclib/fixlinks.py' which
147 # scans *all* html files, builds an index of all (unique) anchors and
148 # then fixes the url part of all links with correct anchor but bad
156 ###########################################################################
161 # Naja ... etwas rumgehackt aber was solls ...
164 pathbase = len(env.Dir('#').abspath)+1
165 for module in env.Alias('all_docs')[0].sources:
166 if module.name != 'html.stamp' : continue
167 mods[module.dir.dir.dir.abspath] = [ module.dir.dir.dir.name,
168 module.dir.abspath[pathbase:],
177 if len(rv[i]) > pathbase and mod.startswith(rv[i] + '/'):
178 level = mods[rv[i]][2] + 1
180 while i < len(rv) and mods[rv[i]][2] >= level:
190 if mods[mod][2] == 0:
191 mods[mod][0] = 'lib' + mods[mod][0]
194 for name,path in EXTRA_MODULES:
195 path = env.Dir(path).dir.dir.abspath
199 mods[rv[i]][0] = name
201 while i+m < len(rv) and mods[rv[i+m]][2] > mods[rv[i]][2]:
210 return ( tuple(mods[mod]) for mod in rv )
213 ix = len(env.Dir('#').abspath)+1
214 return [ doc.dir.abspath[ix:]
215 for doc in env.Alias('all_docs')[0].sources
216 if doc.name == "search.idx" ]
218 def writeTemplate(target = None, source = None, env = None):
219 file(target[0].abspath,"w").write(yaptu.process(str(env['TEMPLATE']), globals(), env.Dictionary()))
221 writeTemplate = env.Action(writeTemplate, varlist = [ 'TEMPLATE' ])
223 ###########################################################################
225 # Extra documentation modules which are handled (named) different from
228 ('Overview', '#/doc/html'),
229 ('Examples', '#/Examples/doc/html'),
230 ('HowTos', '#/HowTos/doc/html'),
231 ('SENFSCons', '#/senfscons/doc/html') ]
233 HEADER = """<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
236 <title>$title</title>
237 <link href="@TOPDIR@/doc/html/doxygen.css" rel="stylesheet" type="text/css">
238 <link href="@TOPDIR@/doclib/senf.css" rel="stylesheet" type="text/css">
239 <link rel="shortcut icon" href="@TOPDIR@/doclib/favicon.ico">
240 <style type="text/css">
241 div.tabs li.$projectname a { background-color: #EDE497; }
250 <form action="@TOPDIR@/doclib/search.php" method="get">
251 Search: <input type="text" name="query" size="20" accesskey="s"/>
254 <h1>SENF Extensible Network Framework</h1>
259 <li><a href="@TOPDIR@/doc/html/index.html">Home</a></li>
260 <li><a class="ext" href="http://satext.fokus.fraunhofer.de/senf/debian">Download</a></li>
261 <li><a class="ext" href="http://openfacts2.berlios.de/wikien/index.php/BerliosProject:SENF_Network_Framework">Wiki</a></li>
262 <li><a class="ext" href="http://developer.berlios.de/projects/senf">BerliOS</a></li>
263 <li><a class="ext" href="http://svn.berlios.de/wsvn/senf/?op=log&rev=0&sc=0&isdir=1">ChangeLog</a></li>
264 <li><a class="ext" href="http://svn.berlios.de/viewcvs/senf/trunk/">Browse SVN</a></li>
265 <li><a class="ext" href="http://developer.berlios.de/bugs/?group_id=7489">Bug Tracker</a></li>
266 <li><a href="@TOPDIR@/doc/html/xref.html">Open Issues</a></li>
273 <div class="tabs menu">
275 {{ for name, path, level in modules():
276 <li class="${name} level${level}"><a href="@TOPDIR@/${path}/index.html">${name}</a></li>
278 <li class="glossary level0"><a href="@TOPDIR@/doc/html/glossary.html">Glossary</a></li>
282 FOOTER = """<hr style="width:0px;border:none;clear:both;margin:0;padding:0" />
287 <a href="mailto:senf-dev@lists.berlios.de">Contact: senf-dev@lists.berlios.de</a> |
288 Copyright © 2006 Fraunhofer Gesellschaft, SatCom, Stefan Bund
294 <?php include 'search_functions.php'; ?>
295 <?php search(); ?>"""
297 SEARCH_PATHS_PHP="""<?php
300 {{ for index in indices():
307 env.Command('doxy-header.html', 'SConscript', writeTemplate,
308 TEMPLATE = Literal(HEADER),
309 TITLE = "Documentation and API reference")
310 env.Command('doxy-footer.html', 'SConscript', writeTemplate,
311 TEMPLATE = Literal(FOOTER))
312 env.Alias('all_docs',
313 env.Command('search.php', [ 'html-munge.xsl', 'SConscript' ],
315 'xsltproc --nonet --html --stringparam topdir .. -o - $SOURCE $TARGET 2>/dev/null'
317 + r" -e 's/\[\[/<?/g' -e 's/\]\]/?>/g'"
318 + r" -e 's/\$$projectname/Overview/g'"
319 + r" -e 's/\$$title/Search results/g'"
320 + "> ${TARGETS[0]}.tmp",
321 'mv ${TARGET}.tmp ${TARGET}' ],
322 TEMPLATE = Literal(HEADER
323 + SEARCH_PHP.replace('<?','[[').replace('?>',']]')
325 TITLE = "Search results"))
326 env.Alias('all_docs',
327 env.Command('search_paths.php', 'SConscript', writeTemplate,
328 TEMPLATE = Literal(SEARCH_PATHS_PHP)))
330 env.Alias('install_all',
331 env.Install( '$DOCINSTALLDIR/doclib', [ 'favicon.ico',
334 'search_functions.php',
338 env.Clean('all', 'doxy-header.html') # I should not need this but I do ...
339 env.Clean('all_docs', 'doxy-header.html') # I should not need this but I do ...