# HG changeset patch # User Matt Mackall # Date 2011-07-23 19:33:35 # Node ID ab545a15d8073a52f369b36a3f1140c9c4e87c55 # Parent 545e00279670423696ed64af8aa9b0c882b44f09 templater: use a global funcs table diff --git a/mercurial/templater.py b/mercurial/templater.py --- a/mercurial/templater.py +++ b/mercurial/templater.py @@ -172,14 +172,14 @@ def runmap(context, mapping, data): def buildfunc(exp, context): n = getsymbol(exp[1]) args = [compileexp(x, context) for x in getlist(exp[2])] + if n in funcs: + f = funcs[n] + return (f, args) if n in context._filters: if len(args) != 1: raise error.ParseError(_("filter %s expects one argument") % n) f = context._filters[n] return (runfilter, (args[0][0], args[0][1], f)) - elif n in context._funcs: - f = context._funcs[n] - return (f, args) methods = { "string": lambda e, c: (runstring, e[1]), @@ -191,6 +191,9 @@ methods = { "func": buildfunc, } +funcs = { +} + # template engine path = ['templates', '../templates']