comparison mercurial/templateutil.py @ 37073:44757e6dad93

templater: introduce resourcemapper class A couple more functions will be added later to work around nested mapping bugs such as the issue 5612.
author Yuya Nishihara <yuya@tcha.org>
date Thu, 15 Mar 2018 20:43:39 +0900
parents 1101d6747d2d
children 2891079fb0c0
comparison
equal deleted inserted replaced
37072:d64ae4fef471 37073:44757e6dad93
347 except TemplateNotFound: 347 except TemplateNotFound:
348 v = default 348 v = default
349 if callable(v) and getattr(v, '_requires', None) is None: 349 if callable(v) and getattr(v, '_requires', None) is None:
350 # old templatekw: expand all keywords and resources 350 # old templatekw: expand all keywords and resources
351 # (TODO: deprecate this after porting web template keywords to new API) 351 # (TODO: deprecate this after porting web template keywords to new API)
352 props = {k: f(context, mapping, k) 352 props = {k: context._resources.lookup(context, mapping, k)
353 for k, f in context._resources.items()} 353 for k in context._resources.knownkeys()}
354 # pass context to _showcompatlist() through templatekw._showlist() 354 # pass context to _showcompatlist() through templatekw._showlist()
355 props['templ'] = context 355 props['templ'] = context
356 props.update(mapping) 356 props.update(mapping)
357 return v(**pycompat.strkwargs(props)) 357 return v(**pycompat.strkwargs(props))
358 if callable(v): 358 if callable(v):