resources: Create a common ResourceFinder interface

And make both .Resources and resources implement it.

This gets us 2 new methods/functions, so you can now also do:

* .Resources.Get
* resources.ByType

Note that GetRemote is not covered by this interface, as that is only available as a global template function.

Fixes #8653
This commit is contained in:
Bjørn Erik Pedersen
2021-10-20 10:11:48 +02:00
parent 20162518c4
commit e58a540895
7 changed files with 148 additions and 36 deletions

View File

@@ -21,7 +21,7 @@ import (
"github.com/spf13/cast"
)
func TestStringTypes(t *testing.T) {
func TestRenderedString(t *testing.T) {
c := qt.New(t)
// Validate that it will behave like a string in Hugo settings.