##// END OF EJS Templates
formatter: remove template resources from nested items before generating JSON
Yuya Nishihara -
r37520:40c7347f default
parent child Browse files
Show More
@@ -200,7 +200,14 b' class _mappingsequence(wrapped):'
200 return self.join(context, mapping, self._defaultsep)
200 return self.join(context, mapping, self._defaultsep)
201
201
202 def tovalue(self, context, mapping):
202 def tovalue(self, context, mapping):
203 return list(self.itermaps(context))
203 knownres = context.knownresourcekeys()
204 items = []
205 for nm in self.itermaps(context):
206 # drop internal resources (recursively) which shouldn't be displayed
207 lm = context.overlaymap(mapping, nm)
208 items.append({k: unwrapvalue(context, lm, v)
209 for k, v in nm.iteritems() if k not in knownres})
210 return items
204
211
205 class mappinggenerator(_mappingsequence):
212 class mappinggenerator(_mappingsequence):
206 """Wrapper for generator of template mappings
213 """Wrapper for generator of template mappings
@@ -105,6 +105,8 b" default output of '{lines}' should be re"
105
105
106 several filters can be applied to '{lines}'
106 several filters can be applied to '{lines}'
107
107
108 $ hg annotate -T'{lines|json}\n' a
109 [{"line": "a\n", "rev": 0}, {"line": "a\n", "rev": 1}, {"line": "a\n", "rev": 1}]
108 $ hg annotate -T'{lines|stringify}' a
110 $ hg annotate -T'{lines|stringify}' a
109 0: a
111 0: a
110 1: a
112 1: a
General Comments 0
You need to be logged in to leave comments. Login now