X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=doclib%2FSConscript;h=e72656b9faa09f2f2f0441efbea5969e5e8e9e6a;hb=81ffa1c459b96dd44472bcef37e1e373934ee138;hp=0d93b9338f81176ba9c4c09cbacf179f26a83fa0;hpb=47be4c5261340d3e2ea208bb0b2d96fa256d829a;p=senf.git diff --git a/doclib/SConscript b/doclib/SConscript index 0d93b93..e72656b 100644 --- a/doclib/SConscript +++ b/doclib/SConscript @@ -5,15 +5,157 @@ import SENFSCons ########################################################################### -# This is not nice .. really ... -env.Alias( - 'all_docs', - env.Command('search.php', - [ 'doxy-header-overview.html', 'doxy-footer.html', 'html-munge.xsl' ], - [ "sed -e 's/\\$$title/Search results/g' -e 's/\\$$projectname/Overview/g' ${SOURCES[0]} > ${TARGET}.tmp", - 'echo "PHPSEARCH" >> ${TARGET}.tmp', - 'cat ${SOURCES[1]} >> ${TARGET}.tmp', - 'xsltproc --nonet --html --stringparam topdir .. -o - ${SOURCES[2]} ${TARGET}.tmp 2>/dev/null' - + '| sed -e "s/PHPSEARCH//" > $TARGET', - 'rm -f ${TARGET}.tmp' ])) +import yaptu +def modules(): + # Naja ... etwas rumgehackt aber was solls ... + global EXTRA_MODULES + mods = {} + ix = len(env.Dir('#').abspath)+1 + ex = dict((env.Dir(p).abspath,True) for n,p in EXTRA_MODULES) + for module in env.Alias('all_docs')[0].sources: + if module.name != 'html.stamp' : continue + if not ex.get(module.dir.abspath): + mods[module.dir.dir.dir.abspath] = [ module.dir.dir.dir.name, module.dir.abspath[ix:], 0 ] + rv = [] + keys = mods.keys() + keys.sort() + for mod in keys: + i = 0 + while i < len(rv): + if mod.startswith(rv[i] + '/'): + level = mods[rv[i]][2] + 1 + i += 1 + while i < len(rv) and mods[rv[i]][2] >= level: + i += 1 + rv[i:i] = [ mod ] + mods[mod][2] = level + break + i += 1 + if i == len(rv): + rv.append(mod) + return [ (name, env.Dir(path).abspath[ix:], 0) for name,path in EXTRA_MODULES + ] + [ ( (((not mods[mod][2]) and 'lib') or '') + mods[mod][0], + mods[mod][1], + mods[mod][2]) + for mod in rv ] + +def indices(): + ix = len(env.Dir('#').abspath)+1 + return [ doc.dir.abspath[ix:] + for doc in env.Alias('all_docs')[0].sources + 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())) + +writeTemplate = env.Action(writeTemplate, varlist = [ 'TEMPLATE' ]) + +########################################################################### + +# Extra documentation modules which are handled (named) different from +# library modules +EXTRA_MODULES = [ + ('Overview', '#/doc/html'), + ('Examples', '#/Examples/doc/html'), + ('SENFSCons', '#/senfscons/doc/html') ] + +HEADER = """ + + +$title + + + + + + + + + +
+
+ """ + +OVERVIEW_EXTRA_HEADER="" + +FOOTER = """
+
+
+ +""" + +SEARCH_PHP=""" + +""" + +SEARCH_PATHS_PHP="""""" + +env.Command('doxy-header.html', 'SConscript', writeTemplate, + TEMPLATE = Literal(HEADER), + TITLE = "Documentation and API reference") +env.Command('doxy-header-overview.html', 'SConscript', writeTemplate, + TEMPLATE = Literal(HEADER+OVERVIEW_EXTRA_HEADER), + TITLE = "Introduction and Overview") +env.Command('doxy-footer.html', 'SConscript', writeTemplate, + TEMPLATE = Literal(FOOTER)) +env.Alias('all_docs', + env.Command('search.php', [ 'html-munge.xsl', 'SConscript' ], + [ writeTemplate, + 'xsltproc --nonet --html --stringparam topdir .. -o - $SOURCE $TARGET 2>/dev/null' + + "| sed" + + r" -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 + + OVERVIEW_EXTRA_HEADER + + SEARCH_PHP.replace('',']]') + + FOOTER), + TITLE = "Search results")) +env.Alias('all_docs', + env.Command('search_paths.php', 'SConscript', writeTemplate, + TEMPLATE = Literal(SEARCH_PATHS_PHP)))