Create a struct with all of Hugo's config options

Primary motivation is documentation, but it will also hopefully simplify the code.

Also,

* Lower case the default output format names; this is in line with the custom ones (map keys) and how
it's treated all the places. This avoids doing `stringds.EqualFold` everywhere.

Closes #10896
Closes #10620
This commit is contained in:
Bjørn Erik Pedersen
2023-01-04 18:24:36 +01:00
parent 6aededf6b4
commit 241b21b0fd
337 changed files with 13377 additions and 14898 deletions

View File

@@ -39,8 +39,6 @@ const (
)
type ResourceCache struct {
rs *Spec
sync.RWMutex
// Either resource.Resource or resource.Resources.
@@ -77,12 +75,12 @@ var extAliasKeywords = map[string][]string{
// used to do resource cache invalidations.
//
// We use the first directory path element and the extension, so:
// a/b.json => "a", "json"
// b.json => "json"
//
// a/b.json => "a", "json"
// b.json => "json"
//
// For some of the extensions we will also map to closely related types,
// e.g. "scss" will also return "sass".
//
func ResourceKeyPartitions(filename string) []string {
var partitions []string
filename = glob.NormalizePath(filename)
@@ -124,15 +122,6 @@ func ResourceKeyContainsAny(key string, partitions []string) bool {
return false
}
func newResourceCache(rs *Spec) *ResourceCache {
return &ResourceCache{
rs: rs,
fileCache: rs.FileCaches.AssetsCache(),
cache: make(map[string]any),
nlocker: locker.NewLocker(),
}
}
func (c *ResourceCache) clear() {
c.Lock()
defer c.Unlock()