Mercurial > public > mercurial-scm > hg
diff mercurial/templatefuncs.py @ 43695:fa246ada356b
templates: make {indent("", " ")} be empty
indent() is documented to indent all non-empty lines, but it made an
exception for the first line, which always got indented. I also made
indent() not indent the first line even if an indent override was
given for the first line. I think that is what one would usually want.
Differential Revision: https://phab.mercurial-scm.org/D7432
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Fri, 15 Nov 2019 10:16:27 -0800 |
parents | d783f945a701 |
children | fc1fa3a07af6 |
line wrap: on
line diff
--- a/mercurial/templatefuncs.py Fri Nov 15 10:16:22 2019 -0800 +++ b/mercurial/templatefuncs.py Fri Nov 15 10:16:27 2019 -0800 @@ -310,13 +310,11 @@ text = evalstring(context, mapping, args[0]) indent = evalstring(context, mapping, args[1]) + firstline = indent if len(args) == 3: firstline = evalstring(context, mapping, args[2]) - else: - firstline = indent - # the indent function doesn't indent the first line, so we do it here - return templatefilters.indent(firstline + text, indent) + return templatefilters.indent(text, indent, firstline=firstline) @templatefunc(b'get(dict, key)')