mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-18 21:11:19 +02:00
@@ -24,7 +24,7 @@ import (
|
||||
|
||||
"github.com/gohugoio/hugo/helpers"
|
||||
|
||||
"github.com/gohugoio/hugo/hugofs/glob"
|
||||
hglob "github.com/gohugoio/hugo/hugofs/glob"
|
||||
|
||||
"github.com/gohugoio/hugo/resources/resource"
|
||||
|
||||
@@ -83,7 +83,7 @@ var extAliasKeywords = map[string][]string{
|
||||
// e.g. "scss" will also return "sass".
|
||||
func ResourceKeyPartitions(filename string) []string {
|
||||
var partitions []string
|
||||
filename = glob.NormalizePath(filename)
|
||||
filename = hglob.NormalizePath(filename)
|
||||
dir, name := path.Split(filename)
|
||||
ext := strings.TrimPrefix(path.Ext(filepath.ToSlash(name)), ".")
|
||||
|
||||
@@ -282,7 +282,7 @@ func (c *ResourceCache) DeletePartitions(partitions ...string) {
|
||||
}
|
||||
}
|
||||
|
||||
func (c *ResourceCache) DeleteMatches(re *regexp.Regexp) {
|
||||
func (c *ResourceCache) DeleteMatchesRe(re *regexp.Regexp) {
|
||||
c.Lock()
|
||||
defer c.Unlock()
|
||||
|
||||
@@ -292,3 +292,14 @@ func (c *ResourceCache) DeleteMatches(re *regexp.Regexp) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (c *ResourceCache) DeleteMatches(match func(string) bool) {
|
||||
c.Lock()
|
||||
defer c.Unlock()
|
||||
|
||||
for k := range c.cache {
|
||||
if match(k) {
|
||||
delete(c.cache, k)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user