mercurial/templater.py
changeset 20518 1e43f15a647f
parent 20371 6f3fb6a974e0
child 20519 cda9d2b6beab
equal deleted inserted replaced
20517:2158e8f3cbd2 20518:1e43f15a647f
   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 
   434 funcs = {
   447 funcs = {
   435     "date": date,
   448     "date": date,
   436     "fill": fill,
   449     "fill": fill,
   437     "get": get,
   450     "get": get,
   438     "if": if_,
   451     "if": if_,
       
   452     "ifcontains": ifcontains,
   439     "ifeq": ifeq,
   453     "ifeq": ifeq,
   440     "join": join,
   454     "join": join,
   441     "label": label,
   455     "label": label,
   442     "pad": pad,
   456     "pad": pad,
   443     "rstdoc": rstdoc,
   457     "rstdoc": rstdoc,