From: g0dil Date: Tue, 24 Apr 2007 23:32:21 +0000 (+0000) Subject: Autogenerate doxy-header and footer from template in doclib/SConscript X-Git-Url: http://g0dil.de/git?a=commitdiff_plain;h=532dab5ed9c5a51af5736e893e9b4a1af698bac4;hp=47be4c5261340d3e2ea208bb0b2d96fa256d829a;p=senf.git Autogenerate doxy-header and footer from template in doclib/SConscript Adjust search.php and search_paths.php generation git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@232 270642c3-0616-0410-b53a-bc976706d245 --- diff --git a/SConstruct b/SConstruct index 5ce43a2..7d09e74 100644 --- a/SConstruct +++ b/SConstruct @@ -41,7 +41,6 @@ SENFSCons.Doxygen(env) SENFSCons.DoxyXRef(env, HTML_HEADER = '#/doclib/doxy-header-overview.html', HTML_FOOTER = '#/doclib/doxy-footer.html') -SENFSCons.DoxySearch(env) # Create Doxyfile.local if not cleaning and the file does not exist # otherwise doxygen will barf on this non-existent file diff --git a/doclib/SConscript b/doclib/SConscript index 0d93b93..ddaa95e 100644 --- a/doclib/SConscript +++ b/doclib/SConscript @@ -5,15 +5,125 @@ 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(): + global EXTRA_MODULES + rv = [] + ix = len(env.Dir('#').abspath)+1 + for module in env.Alias('all_docs')[0].sources: + if module.name != 'html.stamp' : continue + if not [ x for x in EXTRA_MODULES if env.Dir(x[1]).abspath == module.dir.abspath]: + rv.append(('lib%s' % module.dir.dir.dir.name, module.dir.abspath[ix:])) + rv.sort() + return [ (name, env.Dir(path).abspath[ix:]) for name,path in EXTRA_MODULES ] + 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(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 + + + + + + + + +
+
+ """ + +FOOTER = """
+
+
+ +""" + +OVERVIEW_EXTRA_HEADER=""" +
+ +
""" + +SEARCH_PHP=""" + +""" + +SEARCH_PATHS_PHP="""""" + +env.Command('doxy-header.html', None, writeTemplate, + TEMPLATE = HEADER, + TITLE = "Documentation and API reference") +env.Command('doxy-header-overview.html', None, writeTemplate, + TEMPLATE = HEADER+OVERVIEW_EXTRA_HEADER, + TITLE = "Introduction and Overview") +env.Command('doxy-footer.html', None, writeTemplate, + TEMPLATE = FOOTER) +env.Alias('all_docs', + env.Command('search.php', 'html-munge.xsl', + [ writeTemplate, + 'xsltproc --nonet --html --stringparam topdir .. -o - $SOURCE $TARGET 2>/dev/null' + + r'| sed -e "s/\[\[//g" > ${TARGET}.tmp', + 'mv ${TARGET}.tmp ${TARGET}' ], + TEMPLATE = (HEADER + + OVERVIEW_EXTRA_HEADER + + SEARCH_PHP.replace('<','[[').replace('>',']]') + + FOOTER), + TITLE = "Search results")) +env.Alias('all_docs', + env.Command('search_paths.php', None, writeTemplate, + TEMPLATE = SEARCH_PATHS_PHP)) diff --git a/doclib/doxy-footer.html b/doclib/doxy-footer.html deleted file mode 100644 index dd3d9bc..0000000 --- a/doclib/doxy-footer.html +++ /dev/null @@ -1,10 +0,0 @@ -
- - - - diff --git a/doclib/doxy-header-overview.html b/doclib/doxy-header-overview.html deleted file mode 100644 index 28f3fa3..0000000 --- a/doclib/doxy-header-overview.html +++ /dev/null @@ -1,45 +0,0 @@ - - - -$title - - - - - - - - -
-
- - - \ No newline at end of file diff --git a/doclib/doxy-header.html b/doclib/doxy-header.html deleted file mode 100644 index 9981f18..0000000 --- a/doclib/doxy-header.html +++ /dev/null @@ -1,36 +0,0 @@ - - - -$title - - - - - - - - -
-
- diff --git a/doclib/search_functions.php b/doclib/search_functions.php index e3205be..d78c6a7 100644 --- a/doclib/search_functions.php +++ b/doclib/search_functions.php @@ -1,4 +1,4 @@ - + Executing: {"+stat+"}" + exec stat in self.globals,self.locals + i=j+1 + else: # normal line, just copy with substitution + self.ouf.write(self.regex.sub(repl,line)) + i=i+1 + def __init__(self, regex=_never, dict={}, + restat=_never, restend=_never, recont=_never, + preproc=identity, handle=nohandle, ouf=sys.stdout): + "Initialize self's attributes" + self.regex = regex + self.globals = dict + self.locals = { '_cb':self.copyblock } + self.restat = restat + self.restend = restend + self.recont = recont + self.preproc = preproc + self.handle = handle + self.ouf = ouf + def copy(self, block=None, inf=sys.stdin): + "Entry point: copy-with-processing a file, or a block of lines" + if block is None: block = inf.readlines() + self.locals['_bl'] = block + self.copyblock() + +_RE_EXPR = re.compile('{([^{}]+)}') +_RE_BEGIN = re.compile('{{') +_RE_END = re.compile('}}') +_RE_CONT = re.compile(r'\|\|') + +def process(text,*args): + vardict = {} + for arg in args : vardict.update(arg) + vardict['obr'] = '{' + vardict['cbr'] = '}' + output = StringIO() + c = copier(_RE_EXPR, vardict, _RE_BEGIN, _RE_END, _RE_CONT, + ouf = output) + lines = [ line+'\n' for line in text.split("\n") ] + c.copy(lines) + return output.getvalue() diff --git a/senfscons/SENFSCons.py b/senfscons/SENFSCons.py index 623bbc7..10ca5f7 100644 --- a/senfscons/SENFSCons.py +++ b/senfscons/SENFSCons.py @@ -465,20 +465,6 @@ def DoxyXRef(env, docs=None, return xref -def DoxySearch(env, docs=None): - if docs is None: - docs = env.Alias('all_docs')[0].sources - indices = [ doc for doc in docs if doc.name == "search.idx" ] - commands = [ "echo '$TARGET" ] - root = env.Dir('#').abspath - commands.extend([ "echo '\"..%s/\",' >>$TARGET" % index.dir.abspath[len(root):] - for index in indices ]) - commands.append("echo '); } ?>' >>$TARGET" ) - target = env.Command("doc/html/search_paths.php", indices, commands) - env.Alias('all_docs', target) - return target - - ## \brief Build library # # This target helper will build the given library. The library will be