Mercurial > hg-stable
changeset 18289:9bfb53106328
templater: add no-op template function 'label'
author | Sean Farley <sean.michael.farley@gmail.com> |
---|---|
date | Sat, 22 Dec 2012 21:46:26 -0600 |
parents | 0d5a22f73a1f |
children | 323e1267de36 |
files | mercurial/templater.py |
diffstat | 1 files changed, 10 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/templater.py Wed Jan 09 20:27:17 2013 +0100 +++ b/mercurial/templater.py Sat Dec 22 21:46:26 2012 -0600 @@ -265,6 +265,15 @@ t = stringify(args[3][0](context, mapping, args[3][1])) yield runtemplate(context, mapping, compiletemplate(t, context)) +def label(context, mapping, args): + if len(args) != 2: + # i18n: "label" is a keyword + raise error.ParseError(_("label expects two arguments")) + + # ignore args[0] (the label string) since this is supposed to be a a no-op + t = stringify(args[1][0](context, mapping, args[1][1])) + yield runtemplate(context, mapping, compiletemplate(t, context)) + methods = { "string": lambda e, c: (runstring, e[1]), "symbol": lambda e, c: (runsymbol, e[1]), @@ -280,6 +289,7 @@ "ifeq": ifeq, "join": join, "sub": sub, + "label": label, } # template engine