tpl/transform: Include options in cache key

See #5555
This commit is contained in:
Bjørn Erik Pedersen
2018-12-23 21:34:17 +01:00
parent 62d031aedf
commit be58c7b9c8
2 changed files with 13 additions and 0 deletions

View File

@@ -18,6 +18,7 @@ import (
"encoding/csv"
"encoding/json"
"fmt"
"strings"
"github.com/gohugoio/hugo/common/herrors"
@@ -39,6 +40,14 @@ type Decoder struct {
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: ',',