hugo

Unnamed repository; edit this file 'description' to name the repository.

git clone git://git.shimmy1996.com/hugo.git
commit 046320d3f41e8331583da2ec896ca563eef6dbcb
parent c38bfda43bde093aa5f3b3245e3d2de5190d1991
Author: Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Date:   Sun, 27 Nov 2016 18:01:43 +0100

tpl: Fix params case issue with nested template funcs

Fixes #2740

Diffstat:
Mtpl/template_ast_transformers.go | 3+++
Mtpl/template_ast_transformers_test.go | 12++++++++++++
2 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/tpl/template_ast_transformers.go b/tpl/template_ast_transformers.go
@@ -97,7 +97,10 @@ func (c *templateContext) paramsKeysToLower(n parse.Node) {
 				c.updateIdentsIfNeeded(an.Ident)
 			case *parse.VariableNode:
 				c.updateIdentsIfNeeded(an.Ident)
+			case *parse.PipeNode:
+				c.paramsKeysToLower(an)
 			}
+
 		}
 	}
 }
diff --git a/tpl/template_ast_transformers_test.go b/tpl/template_ast_transformers_test.go
@@ -104,6 +104,12 @@ RANGE: {{ . }}: {{ $.Params.LOWER }}
 {{ .NotParam }}
 {{ .NotParam }}
 {{ $notparam }}
+
+
+{{ $lower := .Site.Params.LOWER }}
+F1: {{ printf "themes/%s-theme" .Site.Params.LOWER }}
+F2: {{ Echo (printf "themes/%s-theme" $lower) }}
+F3: {{ Echo (printf "themes/%s-theme" .Site.Params.LOWER) }}
 `
 )
 
@@ -152,6 +158,12 @@ func TestParamsKeysToLower(t *testing.T) {
 	require.Contains(t, result, "RANGE: 3: P1L")
 
 	require.Contains(t, result, "Hi There")
+
+	// Issue #2740
+	require.Contains(t, result, "F1: themes/P2L-theme")
+	require.Contains(t, result, "F2: themes/P2L-theme")
+	require.Contains(t, result, "F3: themes/P2L-theme")
+
 }
 
 func BenchmarkTemplateParamsKeysToLower(b *testing.B) {