From: g0dil Date: Fri, 27 Apr 2007 13:20:59 +0000 (+0000) Subject: Change template quoting style and add Literal commands to make templates portable... X-Git-Url: http://g0dil.de/git?a=commitdiff_plain;h=6a11fb9e93c0c48b6d5c6d7093082bff101740ad;p=senf.git Change template quoting style and add Literal commands to make templates portable accross SCons versions git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@236 270642c3-0616-0410-b53a-bc976706d245 --- diff --git a/doclib/SConscript b/doclib/SConscript index c3303e3..fd5ba39 100644 --- a/doclib/SConscript +++ b/doclib/SConscript @@ -11,9 +11,10 @@ def modules(): global EXTRA_MODULES rv = [] 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 [ x for x in EXTRA_MODULES if env.Dir(x[1]).abspath == module.dir.abspath]: + if not ex.get(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 @@ -25,7 +26,7 @@ def indices(): 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())) + file(target[0].abspath,"w").write(yaptu.process(str(env['TEMPLATE']), globals(), env.Dictionary())) writeTemplate = env.Action(writeTemplate, varlist = [ 'TEMPLATE' ]) @@ -45,7 +46,7 @@ HEADER = """ @@ -57,7 +58,7 @@ div.tabs ul li.$projectname a {obr} background-color: #EDE497; {cbr}

SENF Extensible Network Framework

-

{TITLE}

+

${TITLE}

@@ -65,7 +66,7 @@ div.tabs ul li.$projectname a {obr} background-color: #EDE497; {cbr} """ @@ -99,31 +100,31 @@ SEARCH_PATHS_PHP="""""" env.Command('doxy-header.html', None, writeTemplate, - TEMPLATE = HEADER, + TEMPLATE = Literal(HEADER), TITLE = "Documentation and API reference") env.Command('doxy-header-overview.html', None, writeTemplate, - TEMPLATE = HEADER+OVERVIEW_EXTRA_HEADER, + TEMPLATE = Literal(HEADER+OVERVIEW_EXTRA_HEADER), TITLE = "Introduction and Overview") env.Command('doxy-footer.html', None, writeTemplate, - TEMPLATE = FOOTER) + TEMPLATE = Literal(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('',']]') - + FOOTER), + TEMPLATE = Literal(HEADER + + OVERVIEW_EXTRA_HEADER + + SEARCH_PHP.replace('',']]') + + FOOTER), TITLE = "Search results")) env.Alias('all_docs', env.Command('search_paths.php', None, writeTemplate, - TEMPLATE = SEARCH_PATHS_PHP)) + TEMPLATE = Literal(SEARCH_PATHS_PHP))) diff --git a/doclib/yaptu.py b/doclib/yaptu.py index e3669aa..5c8d14f 100644 --- a/doclib/yaptu.py +++ b/doclib/yaptu.py @@ -79,7 +79,7 @@ class copier: self.locals['_bl'] = block self.copyblock() -_RE_EXPR = re.compile('{([^{}]+)}') +_RE_EXPR = re.compile('\${([^{}]+)}') _RE_BEGIN = re.compile('{{') _RE_END = re.compile('}}') _RE_CONT = re.compile(r'\|\|') @@ -87,8 +87,6 @@ _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)