changeset 10854:4036634560d6

templater: strip whitespace inside template methods
author Matt Mackall <mpm@selenic.com>
date Mon, 05 Apr 2010 15:25:08 -0500
parents b6f6d9fd53d6
children 62216faed067
files mercurial/templater.py
diffstat 1 files changed, 5 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/templater.py	Mon Apr 05 15:25:08 2010 -0500
+++ b/mercurial/templater.py	Mon Apr 05 15:25:08 2010 -0500
@@ -139,17 +139,18 @@
 
             if '%' in expr:
                 key, t = expr.split('%')
-                parsed.append((self._format, (key, self._load(t))))
+                parsed.append((self._format, (key.strip(),
+                                              self._load(t.strip()))))
             elif '|' in expr:
                 parts = expr.split('|')
-                val = parts[0]
+                val = parts[0].strip()
                 try:
-                    filters = [self._filters[f] for f in parts[1:]]
+                    filters = [self._filters[f.strip()] for f in parts[1:]]
                 except KeyError, i:
                     raise SyntaxError(_("unknown filter '%s'") % i[0])
                 parsed.append((self._filter, (filters, val)))
             else:
-                parsed.append((self._get, expr))
+                parsed.append((self._get, expr.strip()))
 
         return parsed