Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/gohugoio/hugo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2021-06-18 11:27:27 +0300
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2021-06-18 11:55:00 +0300
commit93aad3c543828efca2adeb7f96cf50ae29878593 (patch)
tree6a3dd4f6f878f8f36be9cef03a15b78b19d1f3da /hugolib
parent5af045ebab109d3e5501b8b6d9fd448840c96c9a (diff)
Split out the puthe path/filepath functions into common/paths
So they can be used from the config package without cyclic troubles. Updates #8654
Diffstat (limited to 'hugolib')
-rw-r--r--hugolib/config.go7
-rw-r--r--hugolib/content_map_test.go4
-rw-r--r--hugolib/pagecollections.go4
-rw-r--r--hugolib/site.go4
4 files changed, 12 insertions, 7 deletions
diff --git a/hugolib/config.go b/hugolib/config.go
index deba8abe6..091827660 100644
--- a/hugolib/config.go
+++ b/hugolib/config.go
@@ -21,6 +21,7 @@ import (
"github.com/gohugoio/hugo/common/types"
"github.com/gohugoio/hugo/common/maps"
+ cpaths "github.com/gohugoio/hugo/common/paths"
"github.com/gobwas/glob"
hglob "github.com/gohugoio/hugo/hugofs/glob"
@@ -436,7 +437,7 @@ func (l configLoader) loadConfig(configName string) (string, error) {
}
var filename string
- if helpers.ExtNoDelimiter(configName) != "" {
+ if cpaths.ExtNoDelimiter(configName) != "" {
exists, _ := helpers.Exists(baseFilename, l.Fs)
if exists {
filename = baseFilename
@@ -509,7 +510,7 @@ func (l configLoader) loadConfigFromConfigDir() ([]string, error) {
return nil
}
- name := helpers.Filename(filepath.Base(path))
+ name := cpaths.Filename(filepath.Base(path))
item, err := metadecoders.Default.UnmarshalFileToMap(sourceFs, path)
if err != nil {
@@ -520,7 +521,7 @@ func (l configLoader) loadConfigFromConfigDir() ([]string, error) {
if name != "config" {
// Can be params.jp, menus.en etc.
- name, lang := helpers.FileAndExtNoDelimiter(name)
+ name, lang := cpaths.FileAndExtNoDelimiter(name)
keyPath = []string{name}
diff --git a/hugolib/content_map_test.go b/hugolib/content_map_test.go
index e5ba983a4..a62380efd 100644
--- a/hugolib/content_map_test.go
+++ b/hugolib/content_map_test.go
@@ -19,7 +19,7 @@ import (
"strings"
"testing"
- "github.com/gohugoio/hugo/helpers"
+ "github.com/gohugoio/hugo/common/paths"
"github.com/gohugoio/hugo/htesting/hqt"
@@ -112,7 +112,7 @@ func TestContentMap(t *testing.T) {
meta["lang"] = lang
meta["path"] = meta.Filename()
meta["classifier"] = files.ClassifyContentFile(fi.Name(), meta.GetOpener())
- meta["translationBaseName"] = helpers.Filename(fi.Name())
+ meta["translationBaseName"] = paths.Filename(fi.Name())
})
}
diff --git a/hugolib/pagecollections.go b/hugolib/pagecollections.go
index 2e4287612..623d5de42 100644
--- a/hugolib/pagecollections.go
+++ b/hugolib/pagecollections.go
@@ -20,6 +20,8 @@ import (
"strings"
"sync"
+ "github.com/gohugoio/hugo/common/paths"
+
"github.com/gohugoio/hugo/hugofs/files"
"github.com/gohugoio/hugo/helpers"
@@ -187,7 +189,7 @@ func (c *PageCollections) getSectionOrPage(ref string) (*contentNode, string) {
langSuffix := "." + m.s.Lang()
// Trim both extension and any language code.
- name := helpers.PathNoExt(filename)
+ name := paths.PathNoExt(filename)
name = strings.TrimSuffix(name, langSuffix)
// These are reserved bundle names and will always be stored by their owning
diff --git a/hugolib/site.go b/hugolib/site.go
index 9921dcc97..2e23368d7 100644
--- a/hugolib/site.go
+++ b/hugolib/site.go
@@ -29,6 +29,8 @@ import (
"strings"
"time"
+ "github.com/gohugoio/hugo/common/paths"
+
"github.com/gohugoio/hugo/common/constants"
"github.com/gohugoio/hugo/common/loggers"
@@ -1418,7 +1420,7 @@ func (s *SiteInfo) createNodeMenuEntryURL(in string) string {
menuEntryURL := in
menuEntryURL = helpers.SanitizeURLKeepTrailingSlash(s.s.PathSpec.URLize(menuEntryURL))
if !s.canonifyURLs {
- menuEntryURL = helpers.AddContextRoot(s.s.PathSpec.BaseURL.String(), menuEntryURL)
+ menuEntryURL = paths.AddContextRoot(s.s.PathSpec.BaseURL.String(), menuEntryURL)
}
return menuEntryURL
}