##// END OF EJS Templates
templatefilters: add parameterized date method
Matt Mackall -
r17639:d42cc3c8 default
parent child Browse files
Show More
@@ -405,9 +405,19 b' def fillfunc(context, mapping, args):'
405
405
406 return fill(text, width)
406 return fill(text, width)
407
407
408 def datefunc(context, mapping, args):
409 if not (1 <= len(args) <= 2):
410 raise error.ParseError(_("date expects one or two arguments"))
411
412 date = args[0][0](context, mapping, args[0][1])
413 if len(args) == 2:
414 fmt = stringify(args[1][0](context, mapping, args[1][1]))
415 return util.datestr(date, fmt)
416 return util.datestr(date)
408
417
409 funcs = {
418 funcs = {
410 "fill": fillfunc,
419 "fill": fillfunc,
420 "date": datefunc,
411 }
421 }
412
422
413 # tell hggettext to extract docstrings from these functions:
423 # tell hggettext to extract docstrings from these functions:
General Comments 0
You need to be logged in to leave comments. Login now