Mercurial > hg
diff mercurial/node.py @ 37327:ebf139cbd4a1
templater: abstract away from joinfmt
Future patches will add a wrapper for a list of template mappings, which
will implement a custom join() something like {join(mappings % template)}.
The original join() function is broken down as follows:
if hasattr(joinset, 'joinfmt'):
# hybrid.join() where values must be a list or a dict
joinitems((joinfmt(x) for x in values), sep)
elif isinstance(joinset, templateutil.wrapped):
# mappable.join()
show()
else:
# a plain list, a generator, or a byte string; joinfmt was identity()
joinset = templateutil.unwrapvalue(context, joinset)
joinitems(pycompat.maybebytestr(joinset), joiner)
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sat, 17 Mar 2018 22:06:31 +0900 |
parents | f574cc00831a |
children | d7114f883505 |