##// END OF EJS Templates
templater: use a global funcs table
Matt Mackall -
r14925:ab545a15 default
parent child Browse files
Show More
@@ -172,14 +172,14 b' def runmap(context, mapping, data):'
172 def buildfunc(exp, context):
172 def buildfunc(exp, context):
173 n = getsymbol(exp[1])
173 n = getsymbol(exp[1])
174 args = [compileexp(x, context) for x in getlist(exp[2])]
174 args = [compileexp(x, context) for x in getlist(exp[2])]
175 if n in funcs:
176 f = funcs[n]
177 return (f, args)
175 if n in context._filters:
178 if n in context._filters:
176 if len(args) != 1:
179 if len(args) != 1:
177 raise error.ParseError(_("filter %s expects one argument") % n)
180 raise error.ParseError(_("filter %s expects one argument") % n)
178 f = context._filters[n]
181 f = context._filters[n]
179 return (runfilter, (args[0][0], args[0][1], f))
182 return (runfilter, (args[0][0], args[0][1], f))
180 elif n in context._funcs:
181 f = context._funcs[n]
182 return (f, args)
183
183
184 methods = {
184 methods = {
185 "string": lambda e, c: (runstring, e[1]),
185 "string": lambda e, c: (runstring, e[1]),
@@ -191,6 +191,9 b' methods = {'
191 "func": buildfunc,
191 "func": buildfunc,
192 }
192 }
193
193
194 funcs = {
195 }
196
194 # template engine
197 # template engine
195
198
196 path = ['templates', '../templates']
199 path = ['templates', '../templates']
General Comments 0
You need to be logged in to leave comments. Login now