diff options
Diffstat (limited to 'helpers')
-rw-r--r-- | helpers/path.go | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/helpers/path.go b/helpers/path.go index 92b58de84..2d0e8aa64 100644 --- a/helpers/path.go +++ b/helpers/path.go @@ -274,6 +274,13 @@ func FileAndExt(in string) (string, string) { return fileAndExt(in, fpb) } +// FileAndExtNoDelimiter takes a path and returns the file and extension separated, +// the extension excluding the delmiter, e.g "md". +func FileAndExtNoDelimiter(in string) (string, string) { + file, ext := fileAndExt(in, fpb) + return file, strings.TrimPrefix(ext, ".") +} + // Filename takes a path, strips out the extension, // and returns the name of the file. func Filename(in string) (name string) { @@ -400,6 +407,8 @@ func ExtractRootPaths(paths []string) []string { } +var numInPathRe = regexp.MustCompile("\\.(\\d+)\\.") + // FindCWD returns the current working directory from where the Hugo // executable is run. func FindCWD() (string, error) { |