diff options
Diffstat (limited to 'tpl/collections')
-rw-r--r-- | tpl/collections/collections_integration_test.go | 29 | ||||
-rw-r--r-- | tpl/collections/collections_test.go | 1 | ||||
-rw-r--r-- | tpl/collections/init.go | 4 | ||||
-rw-r--r-- | tpl/collections/reflect_helpers.go | 9 |
4 files changed, 4 insertions, 39 deletions
diff --git a/tpl/collections/collections_integration_test.go b/tpl/collections/collections_integration_test.go index 3bcd4effb..e39493b52 100644 --- a/tpl/collections/collections_integration_test.go +++ b/tpl/collections/collections_integration_test.go @@ -202,35 +202,6 @@ foo: bc b.AssertFileContent("public/index.html", "<ul><li>P1</li><li>P2</li></ul>") } -// Issue #11498 -func TestEchoParams(t *testing.T) { - t.Parallel() - files := ` --- hugo.toml -- -[params.footer] -string = 'foo' -int = 42 -float = 3.1415 -boolt = true -boolf = false --- layouts/index.html -- -{{ echoParam .Site.Params.footer "string" }} -{{ echoParam .Site.Params.footer "int" }} -{{ echoParam .Site.Params.footer "float" }} -{{ echoParam .Site.Params.footer "boolt" }} -{{ echoParam .Site.Params.footer "boolf" }} - ` - - b := hugolib.Test(t, files) - b.AssertFileContent("public/index.html", - "foo", - "42", - "3.1415", - "true", - "false", - ) -} - func TestTermEntriesCollectionsIssue12254(t *testing.T) { t.Parallel() diff --git a/tpl/collections/collections_test.go b/tpl/collections/collections_test.go index 7dd518759..c89051a3d 100644 --- a/tpl/collections/collections_test.go +++ b/tpl/collections/collections_test.go @@ -233,6 +233,7 @@ func TestReverse(t *testing.T) { } func TestEchoParam(t *testing.T) { + t.Skip("deprecated, will be removed in Hugo 0.133.0") t.Parallel() c := qt.New(t) diff --git a/tpl/collections/init.go b/tpl/collections/init.go index 8801422ac..20711f9e4 100644 --- a/tpl/collections/init.go +++ b/tpl/collections/init.go @@ -69,9 +69,7 @@ func init() { ns.AddMethodMapping(ctx.EchoParam, []string{"echoParam"}, - [][2]string{ - {`{{ echoParam .Params "langCode" }}`, `en`}, - }, + [][2]string{}, ) ns.AddMethodMapping(ctx.First, diff --git a/tpl/collections/reflect_helpers.go b/tpl/collections/reflect_helpers.go index 4687acdde..4b222be15 100644 --- a/tpl/collections/reflect_helpers.go +++ b/tpl/collections/reflect_helpers.go @@ -18,8 +18,8 @@ import ( "fmt" "reflect" + "github.com/gohugoio/hugo/common/hashing" "github.com/gohugoio/hugo/common/types" - "github.com/mitchellh/hashstructure" ) var ( @@ -47,14 +47,9 @@ func numberToFloat(v reflect.Value) (float64, error) { // to make them comparable func normalize(v reflect.Value) any { k := v.Kind() - switch { case !v.Type().Comparable(): - h, err := hashstructure.Hash(v.Interface(), nil) - if err != nil { - panic(err) - } - return h + return hashing.HashUint64(v.Interface()) case isNumber(k): f, err := numberToFloat(v) if err == nil { |