530 return util.datestr(date, fmt) |
530 return util.datestr(date, fmt) |
531 except (TypeError, ValueError): |
531 except (TypeError, ValueError): |
532 # i18n: "date" is a keyword |
532 # i18n: "date" is a keyword |
533 raise error.ParseError(_("date expects a date information")) |
533 raise error.ParseError(_("date expects a date information")) |
534 |
534 |
|
535 @templatefunc('dict([key=value...])', argspec='**kwargs') |
|
536 def dict_(context, mapping, args): |
|
537 """Construct a dict from key-value pairs.""" |
|
538 data = util.sortdict() |
|
539 data.update((k, evalfuncarg(context, mapping, v)) |
|
540 for k, v in args['kwargs'].iteritems()) |
|
541 return templatekw.hybriddict(data) |
|
542 |
535 @templatefunc('diff([includepattern [, excludepattern]])') |
543 @templatefunc('diff([includepattern [, excludepattern]])') |
536 def diff(context, mapping, args): |
544 def diff(context, mapping, args): |
537 """Show a diff, optionally |
545 """Show a diff, optionally |
538 specifying files to include or exclude.""" |
546 specifying files to include or exclude.""" |
539 if len(args) > 2: |
547 if len(args) > 2: |