Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/gohugoio/hugo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tpl
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2016-11-27 20:01:43 +0300
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2016-11-27 21:02:43 +0300
commit046320d3f41e8331583da2ec896ca563eef6dbcb (patch)
tree24579d9ca193ee8d1e1fedc60a947993dd0d060e /tpl
parentc38bfda43bde093aa5f3b3245e3d2de5190d1991 (diff)
tpl: Fix params case issue with nested template funcs
Fixes #2740
Diffstat (limited to 'tpl')
-rw-r--r--tpl/template_ast_transformers.go3
-rw-r--r--tpl/template_ast_transformers_test.go12
2 files changed, 15 insertions, 0 deletions
diff --git a/tpl/template_ast_transformers.go b/tpl/template_ast_transformers.go
index 2020a42e5..19b772add 100644
--- 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
index ee40cc8e4..c78c521c9 100644
--- 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) {