doclib: Fix search.php build command
[senf.git] / doclib / SConscript
index 102709e..3d415b5 100644 (file)
@@ -29,8 +29,9 @@
 # 1. Scanning the Doxyfile's
 # 
 # The doxygen builder scans all documentation source files which have
-# the text 'doxyfile' in any case within them. It understands @INCLUDE
-# directives and will find all the dependencies of the documentation:
+# the text 'doxyfile' in any case in their name. It understands
+# @INCLUDE directives and will find all the dependencies of the
+# documentation:
 # 
 # * All the source files as selected by INPUT, INPUT_PATTERN,
 #   RECURSIVE and so on.
 #
 # * 'doclib/dot' calls the real dot binary. If the resulting image is
 #   more than 800 pixels wide, dot is called again, this time using
-#   the oposite rang direction (top-bottom vs. left-right). Then the
-#   image with the smaller width is selected and returned.
+#   the oposite rank direction (top-bottom vs. left-right). The image
+#   with the smaller width is selected and returned.
 #
 # * after doxygen is finished, the list of referenced tag-files is
 #   checked. For each tag file the directory is found, where the
 #   documentation is generated (by scanning the Doxyfile which is
 #   repsonsible for building the tag file). For every tag file, the
-#   correct 'insstalldox' command is generated
+#   correct 'installdox' command is generated.
 #
 # * The stamp files are created
 #
 #   namespace.
 #
 # * All html files are processed by 'doclib/html-munge.xsl'. However,
-#   since the documentation generated by doxygen is completely broken
-#   we need to preprocess the html files with a simple 'sed' script
-#   and 'tidy' before 'xsltproc' even accepts the html code.
+#   since the documentation generated by doxygen is completely invalid
+#   html we need to preprocess the html files with a simple 'sed'
+#   script and 'tidy' before 'xsltproc' even accepts the html code.
 #
 # * We use the generated xml output of doxygen to generate an XML
 #   fragment for the global cross reference. This fragment is
@@ -215,7 +216,7 @@ def indices():
              if doc.name == "search.idx" ]
 
 def writeTemplate(target = None, source = None, env = None):
-    file(target[0].abspath,"w").write(yaptu.process(str(env['TEMPLATE']), globals(), env.Dictionary()))
+    file(target[0].abspath,"w").write(source[0].read())
 
 writeTemplate = env.Action(writeTemplate, varlist = [ 'TEMPLATE' ])
 
@@ -255,15 +256,15 @@ div.tabs li.$projectname a { background-color: #EDE497; }
   </div>
   <div id="subtitle">
     <ul>
-      <li><a href="@TOPDIR@/doc/html/xref.html">Open Issues</a></li>
-      <li><a class="ext" href="http://developer.berlios.de/bugs/?group_id=7489">Bug Tracker</a></li>
-      <li><a class="ext" href="http://svn.berlios.de/viewcvs/senf/trunk/">Browse SVN</a></li>
-      <li><a class="ext" href="http://svn.berlios.de/wsvn/senf/?op=log&rev=0&sc=0&isdir=1">ChangeLog</a></li>
-      <li><a class="ext" href="http://developer.berlios.de/projects/senf">BerliOS</a></li>
-      <li><a class="ext" href="http://openfacts.berlios.de/index-en.phtml?title=SENF+Network+Framework">Wiki</a></li>
       <li><a href="@TOPDIR@/doc/html/index.html">Home</a></li>
+      <li><a class="ext" href="ftp://ftp.berlios.de/pub/senf/">Download</a></li>
+      <li><a class="ext" href="http://openfacts2.berlios.de/wikien/index.php/BerliosProject:SENF_Network_Framework">Wiki</a></li>
+      <li><a class="ext" href="http://developer.berlios.de/projects/senf">BerliOS</a></li>
+      <li><a class="ext" href="http://svn.berlios.de/wsvn/senf/?op=log&rev=0&sc=0&isdir=1">ChangeLog</a></li>
+      <li><a class="ext" href="http://svn.berlios.de/viewcvs/senf/trunk/">Browse SVN</a></li>
+      <li><a class="ext" href="http://developer.berlios.de/bugs/?group_id=7489">Bug Tracker</a></li>
+      <li><a href="@TOPDIR@/doc/html/xref.html">Open Issues</a></li>
     </ul>
-    <h2>${TITLE}</h2>
   </div>
 </div>
 
@@ -303,28 +304,33 @@ function paths() {
 }
 ?>"""
 
-env.Command('doxy-header.html', 'SConscript', writeTemplate,
-            TEMPLATE = Literal(HEADER),
-            TITLE = "Documentation and API reference")
-env.Command('doxy-footer.html', 'SConscript', writeTemplate,
-            TEMPLATE = Literal(FOOTER))
+header = yaptu.process(HEADER, globals(), env.Dictionary(),
+                       TITLE = "Documentation and API reference")
+
+footer = yaptu.process(FOOTER, globals(), env.Dictionary())
+
+search_php = yaptu.process(HEADER + SEARCH_PHP.replace('<?','[[').replace('?>',']]') + FOOTER,
+                           globals(), env.Dictionary(),
+                           TITLE = "Search results")
+
+search_paths_php = yaptu.process(SEARCH_PATHS_PHP, globals(), env.Dictionary())
+
+env.Command('doxy-header.html', Value(header), writeTemplate)
+env.Command('doxy-footer.html', Value(footer), writeTemplate)
+
 env.Alias('all_docs',
-          env.Command('search.php', [ 'html-munge.xsl', 'SConscript' ],
+          env.Command('search.php', [ Value(search_php), 'html-munge.xsl' ],
                       [ writeTemplate,
-                        'xsltproc --nonet --html --stringparam topdir .. -o - $SOURCE $TARGET 2>/dev/null'
+                        'xsltproc --nonet --html --stringparam topdir .. -o - ${SOURCES[1]} $TARGET 2>/dev/null'
                             + "| sed"
                             +   r" -e 's/\[\[/<?/g' -e 's/\]\]/?>/g'"
                             +   r" -e 's/\$$projectname/Overview/g'"
                             +   r" -e 's/\$$title/Search results/g'"
                             +       "> ${TARGETS[0]}.tmp",
-                        'mv ${TARGET}.tmp ${TARGET}' ],
-                      TEMPLATE = Literal(HEADER
-                                         + SEARCH_PHP.replace('<?','[[').replace('?>',']]')
-                                         + FOOTER),
-                      TITLE = "Search results"))
+                        'mv ${TARGET}.tmp ${TARGET}' ] ))
+
 env.Alias('all_docs',
-          env.Command('search_paths.php', 'SConscript', writeTemplate,
-                      TEMPLATE = Literal(SEARCH_PATHS_PHP)))
+          env.Command('search_paths.php', Value(search_paths_php), writeTemplate))
 
 env.Alias('install_all',
           env.Install( '$DOCINSTALLDIR/doclib', [ 'favicon.ico',