Mercurial > public > mercurial-scm > hg-stable
diff mercurial/templatefilters.py @ 19227:8eef5b93db9d
templater: move templatefilters.func into the same place as the other funcs
author | Sean Farley <sean.michael.farley@gmail.com> |
---|---|
date | Wed, 10 Apr 2013 18:56:38 -0500 |
parents | c2d079387b2c |
children | 889807c79384 |
line wrap: on
line diff
--- a/mercurial/templatefilters.py Wed May 22 17:31:43 2013 -0500 +++ b/mercurial/templatefilters.py Wed Apr 10 18:56:38 2013 -0500 @@ -5,9 +5,8 @@ # This software may be used and distributed according to the terms of the # GNU General Public License version 2 or any later version. -from i18n import _ import cgi, re, os, time, urllib -import encoding, node, util, error +import encoding, node, util import hbisect def addbreaks(text): @@ -401,34 +400,5 @@ text = regexp.sub(format, text) return text -def fillfunc(context, mapping, args): - if not (1 <= len(args) <= 2): - raise error.ParseError(_("fill expects one or two arguments")) - - text = stringify(args[0][0](context, mapping, args[0][1])) - width = 76 - if len(args) == 2: - try: - width = int(stringify(args[1][0](context, mapping, args[1][1]))) - except ValueError: - raise error.ParseError(_("fill expects an integer width")) - - return fill(text, width) - -def datefunc(context, mapping, args): - if not (1 <= len(args) <= 2): - raise error.ParseError(_("date expects one or two arguments")) - - date = args[0][0](context, mapping, args[0][1]) - if len(args) == 2: - fmt = stringify(args[1][0](context, mapping, args[1][1])) - return util.datestr(date, fmt) - return util.datestr(date) - -funcs = { - "fill": fillfunc, - "date": datefunc, -} - # tell hggettext to extract docstrings from these functions: i18nfunctions = filters.values()