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
diff options
context:
space:
mode:
Diffstat (limited to 'tpl/collections/collections.go')
-rw-r--r--tpl/collections/collections.go15
1 files changed, 10 insertions, 5 deletions
diff --git a/tpl/collections/collections.go b/tpl/collections/collections.go
index 5b9d4a700..80f4ccc07 100644
--- a/tpl/collections/collections.go
+++ b/tpl/collections/collections.go
@@ -292,12 +292,17 @@ func (ns *Namespace) In(l interface{}, v interface{}) (bool, error) {
return true, nil
}
}
- case reflect.String:
- if vv.Type() == lv.Type() && strings.Contains(lv.String(), vv.String()) {
- return true, nil
- }
}
- return false, nil
+ ss, err := cast.ToStringE(l)
+ if err != nil {
+ return false, nil
+ }
+
+ su, err := cast.ToStringE(v)
+ if err != nil {
+ return false, nil
+ }
+ return strings.Contains(ss, su), nil
}
// Intersect returns the common elements in the given sets, l1 and l2. l1 and