mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-21 21:35:28 +02:00
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:
@@ -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()
|
||||
|
Reference in New Issue
Block a user