equal
deleted
inserted
replaced
164 except IndexError: |
164 except IndexError: |
165 pass |
165 pass |
166 |
166 |
167 return templatefilters.fill(text, width, initindent, hangindent) |
167 return templatefilters.fill(text, width, initindent, hangindent) |
168 |
168 |
|
169 @templatefunc('filter(iterable)') |
|
170 def filter_(context, mapping, args): |
|
171 """Remove empty elements from a list or a dict.""" |
|
172 if len(args) != 1: |
|
173 # i18n: "filter" is a keyword |
|
174 raise error.ParseError(_("filter expects one argument")) |
|
175 iterable = evalwrapped(context, mapping, args[0]) |
|
176 def select(w): |
|
177 return w.tobool(context, mapping) |
|
178 return iterable.filter(context, mapping, select) |
|
179 |
169 @templatefunc('formatnode(node)', requires={'ui'}) |
180 @templatefunc('formatnode(node)', requires={'ui'}) |
170 def formatnode(context, mapping, args): |
181 def formatnode(context, mapping, args): |
171 """Obtain the preferred form of a changeset hash. (DEPRECATED)""" |
182 """Obtain the preferred form of a changeset hash. (DEPRECATED)""" |
172 if len(args) != 1: |
183 if len(args) != 1: |
173 # i18n: "formatnode" is a keyword |
184 # i18n: "formatnode" is a keyword |