##// END OF EJS Templates
templater: factor out runtemplate method...
Matt Mackall -
r17632:523625e4 default
parent child Browse files
Show More
@@ -161,6 +161,10 b' def buildmap(exp, context):'
161 161 ctmpl = gettemplate(exp[2], context)
162 162 return (runmap, (func, data, ctmpl))
163 163
164 def runtemplate(context, mapping, template):
165 for func, data in template:
166 yield func(context, mapping, data)
167
164 168 def runmap(context, mapping, data):
165 169 func, data, ctmpl = data
166 170 d = func(context, mapping, data)
@@ -172,8 +176,7 b' def runmap(context, mapping, data):'
172 176 for i in d:
173 177 if isinstance(i, dict):
174 178 lm.update(i)
175 for f, d in ctmpl:
176 yield f(context, lm, d)
179 yield runtemplate(context, lm, ctmpl)
177 180 else:
178 181 # v is not an iterable of dicts, this happen when 'key'
179 182 # has been fully expanded already and format is useless.
@@ -276,6 +279,7 b' class engine(object):'
276 279 generator.'''
277 280 return _flatten(func(self, mapping, data) for func, data in
278 281 self._load(t))
282 return _flatten(runtemplate(self, mapping, self._load(t)))
279 283
280 284 engines = {'default': engine}
281 285
General Comments 0
You need to be logged in to leave comments. Login now