mirror of
https://github.com/gohugoio/hugo.git
synced 2025-03-19 15:22:47 +00:00
parent
c38bfda43b
commit
046320d3f4
2 changed files with 15 additions and 0 deletions
|
@ -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)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue