all: Refactor to nonglobal file systems

Updates #2701
Fixes #2951
This commit is contained in:
Bjørn Erik Pedersen
2017-01-10 10:55:03 +01:00
parent 0ada405912
commit c71e1b106e
71 changed files with 2219 additions and 1731 deletions

View File

@@ -16,8 +16,6 @@ package hugolib
import (
"fmt"
"sort"
"github.com/spf13/hugo/helpers"
)
// The TaxonomyList is a list of all taxonomies and their values
@@ -59,26 +57,15 @@ type OrderedTaxonomyEntry struct {
WeightedPages WeightedPages
}
// KeyPrep... Taxonomies should be case insensitive. Can make it easily conditional later.
func kp(in string) string {
return helpers.CurrentPathSpec().MakePathSanitized(in)
}
// Get the weighted pages for the given key.
func (i Taxonomy) Get(key string) WeightedPages {
if val, ok := i[key]; ok {
return val
}
return i[kp(key)]
return i[key]
}
// Count the weighted pages for the given key.
func (i Taxonomy) Count(key string) int { return len(i[kp(key)]) }
func (i Taxonomy) Count(key string) int { return len(i[key]) }
func (i Taxonomy) add(key string, w WeightedPage, pretty bool) {
if !pretty {
key = kp(key)
}
func (i Taxonomy) add(key string, w WeightedPage) {
i[key] = append(i[key], w)
}