"encoding/csv"
"encoding/json"
"fmt"
+ "strings"
"github.com/gohugoio/hugo/common/herrors"
Comment rune
}
+// OptionsKey is used in cache keys.
+func (d Decoder) OptionsKey() string {
+ var sb strings.Builder
+ sb.WriteRune(d.Delimiter)
+ sb.WriteRune(d.Comment)
+ return sb.String()
+}
+
// Default is a Decoder in its default configuration.
var Default = Decoder{
Delimiter: ',',
return nil, errors.New("no Key set in Resource")
}
+ if decoder != metadecoders.Default {
+ key += decoder.OptionsKey()
+ }
+
return ns.cache.GetOrCreate(key, func() (interface{}, error) {
f := metadecoders.FormatFromMediaType(r.MediaType())
if f == "" {