comparison mercurial/templateutil.py @ 37107:7db3c28dfdfd

formatter: port handling of 'originalnode' to populatemap() hook This isn't a pure templating business, so let's move out of the templater module. Note that this works only in web templates where mapping['node'] is a static value.
author Yuya Nishihara <yuya@tcha.org>
date Sat, 17 Mar 2018 17:41:07 +0900
parents f0b6fbea00cf
children 888507ec655e
comparison
equal deleted inserted replaced
37106:be3f33f5e232 37107:7db3c28dfdfd
404 404
405 for i, v in enumerate(diter): 405 for i, v in enumerate(diter):
406 if isinstance(v, dict): 406 if isinstance(v, dict):
407 lm = context.overlaymap(mapping, v) 407 lm = context.overlaymap(mapping, v)
408 lm['index'] = i 408 lm['index'] = i
409 lm['originalnode'] = mapping.get('node')
410 yield evalrawexp(context, lm, targ) 409 yield evalrawexp(context, lm, targ)
411 else: 410 else:
412 # v is not an iterable of dicts, this happen when 'key' 411 # v is not an iterable of dicts, this happen when 'key'
413 # has been fully expanded already and format is useless. 412 # has been fully expanded already and format is useless.
414 # If so, return the expanded value. 413 # If so, return the expanded value.