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>2015-08-26 22:29:32 +0300
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2015-08-26 22:29:32 +0300
commit5b90b388cb5042ee7ee729e70a55228004f0def6 (patch)
tree2c5ccbc96bb8f076cefdc14118c7b46f7261925a /helpers
parentfd2fc1d3cef3f8085ccbb364918597b7f0e9623e (diff)
Unexport FileAndExt
If needed outside helpers, create an exported file path (FilePathAndExt?) and/or a url version.
Diffstat (limited to 'helpers')
-rw-r--r--helpers/path.go8
-rw-r--r--helpers/path_test.go2
-rw-r--r--helpers/url.go2
3 files changed, 6 insertions, 6 deletions
diff --git a/helpers/path.go b/helpers/path.go
index ba6d0e9d1..a9d488469 100644
--- a/helpers/path.go
+++ b/helpers/path.go
@@ -119,7 +119,7 @@ func isMn(r rune) bool {
// ReplaceExtension takes a path and an extension, strips the old extension
// and returns the path with the new extension.
func ReplaceExtension(path string, newExt string) string {
- f, _ := FileAndExt(path, fpb)
+ f, _ := fileAndExt(path, fpb)
return f + "." + newExt
}
@@ -298,7 +298,7 @@ func GetDottedRelativePath(inPath string) string {
// Filename takes a path, strips out the extension,
// and returns the name of the file.
func Filename(in string) (name string) {
- name, _ = FileAndExt(in, fpb)
+ name, _ = fileAndExt(in, fpb)
return
}
@@ -318,7 +318,7 @@ func Filename(in string) (name string) {
// If the path, in, represents a filename with an extension,
// then name will be the filename minus any extension - including the dot
// and ext will contain the extension - minus the dot.
-func FileAndExt(in string, b filepathPathBridge) (name string, ext string) {
+func fileAndExt(in string, b filepathPathBridge) (name string, ext string) {
ext = b.Ext(in)
base := b.Base(in)
@@ -439,7 +439,7 @@ func PrettiyPath(in string, b filepathPathBridge) string {
}
return b.Join(b.Clean(in), "index.html")
}
- name, ext := FileAndExt(in, b)
+ name, ext := fileAndExt(in, b)
if name == "index" {
// /section/name/index.html -> /section/name/index.html
return b.Clean(in)
diff --git a/helpers/path_test.go b/helpers/path_test.go
index 5cf863b6c..85e4e0f10 100644
--- a/helpers/path_test.go
+++ b/helpers/path_test.go
@@ -540,7 +540,7 @@ func TestFileAndExt(t *testing.T) {
}
for i, d := range data {
- file, ext := FileAndExt(filepath.FromSlash(d.input), fpb)
+ file, ext := fileAndExt(filepath.FromSlash(d.input), fpb)
if d.expectedFile != file {
t.Errorf("Test %d failed. Expected filename %q got %q.", i, d.expectedFile, file)
}
diff --git a/helpers/url.go b/helpers/url.go
index 76cc08813..415f11b74 100644
--- a/helpers/url.go
+++ b/helpers/url.go
@@ -260,7 +260,7 @@ func Uglify(in string) string {
return path.Clean(in) + ".html"
}
- name, ext := FileAndExt(in, pb)
+ name, ext := fileAndExt(in, pb)
if name == "index" {
// /section/name/index.html -> /section/name.html
d := path.Dir(in)