299 if test: |
299 if test: |
300 yield _evalifliteral(args[1], context, mapping) |
300 yield _evalifliteral(args[1], context, mapping) |
301 elif len(args) == 3: |
301 elif len(args) == 3: |
302 yield _evalifliteral(args[2], context, mapping) |
302 yield _evalifliteral(args[2], context, mapping) |
303 |
303 |
|
304 def ifcontains(context, mapping, args): |
|
305 if not (3 <= len(args) <= 4): |
|
306 # i18n: "ifcontains" is a keyword |
|
307 raise error.ParseError(_("ifcontains expects three or four arguments")) |
|
308 |
|
309 item = stringify(args[0][0](context, mapping, args[0][1])) |
|
310 items = args[1][0](context, mapping, args[1][1]) |
|
311 |
|
312 if item in items: |
|
313 yield _evalifliteral(args[2], context, mapping) |
|
314 elif len(args) == 4: |
|
315 yield _evalifliteral(args[3], context, mapping) |
|
316 |
304 def ifeq(context, mapping, args): |
317 def ifeq(context, mapping, args): |
305 if not (3 <= len(args) <= 4): |
318 if not (3 <= len(args) <= 4): |
306 # i18n: "ifeq" is a keyword |
319 # i18n: "ifeq" is a keyword |
307 raise error.ParseError(_("ifeq expects three or four arguments")) |
320 raise error.ParseError(_("ifeq expects three or four arguments")) |
308 |
321 |