hugo/tpl
Bjørn Erik Pedersen e2201ef15f
tpl/collections: Fix handling of different interface types in Slice
In Hugo `0.49` we improved type support in `slice`. This has an unfortunate side effect in that `resources.Concat` now expects something that can resolve to `resource.Resources`.

This worked for most situations, but when you try to `slice` different `Resource` objects, you would be getting `[]interface {}` and not `resource.Resources`. And `concat` would fail:

```bash
error calling Concat: slice []interface {} not supported in concat.
```

This commit fixes that by simplifying the type checking logic in `Slice`:

* If the first item implements the `Slicer` interface, we try that
* If the above fails or the first item does not implement `Slicer`, we just return the `[]interface {}`

Fixes #5269
2018-10-10 12:21:42 +02:00
..
cast
collections tpl/collections: Fix handling of different interface types in Slice 2018-10-10 12:21:42 +02:00
compare
crypto
data tpl/data: Revise error handling in getJSON and getCSV 2018-09-11 16:46:25 +02:00
encoding
fmt tpl: Fix golint godoc issues 2018-09-07 08:25:51 +02:00
images
inflect
internal tpl: Fix golint godoc issues 2018-09-07 08:25:51 +02:00
lang tpl: Fix golint godoc issues 2018-09-07 08:25:51 +02:00
math
os
partials
path tpl/collections: Add collections.Append 2018-09-14 10:12:08 +02:00
resources tpl/collections: Add collections.Append 2018-09-14 10:12:08 +02:00
safe
strings tpl/strings: Add strings.FirstUpper 2018-09-07 09:08:14 +02:00
templates
time
tplimpl tpl/opengraph: Use safeHTMLAttr instead of safeHTML for HTML attributes 2018-09-22 00:36:15 +02:00
transform
urls
template.go