hugo

Unnamed repository; edit this file 'description' to name the repository.

git clone git://git.shimmy1996.com/hugo.git
commit 0a768ec95fc44c680c69530e515e11a02196b3d8
parent 8d86f1ec6ed7a707c995548799c924ff3948acfc
Author: Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Date:   Sat, 19 Mar 2016 17:17:17 +0100

Simplify GetDottedRelativePath

Diffstat:
Mhelpers/path.go | 11++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/helpers/path.go b/helpers/path.go
@@ -199,18 +199,19 @@ var isFileRe = regexp.MustCompile(".*\\..{1,6}$")
 // Expects a relative path starting after the content directory.
 func GetDottedRelativePath(inPath string) string {
 	inPath = filepath.Clean(filepath.FromSlash(inPath))
+
 	if inPath == "." {
 		return "./"
 	}
-	isFile := isFileRe.MatchString(inPath)
-	if !isFile {
-		if !strings.HasSuffix(inPath, FilePathSeparator) {
-			inPath += FilePathSeparator
-		}
+
+	if !isFileRe.MatchString(inPath) && !strings.HasSuffix(inPath, FilePathSeparator) {
+		inPath += FilePathSeparator
 	}
+
 	if !strings.HasPrefix(inPath, FilePathSeparator) {
 		inPath = FilePathSeparator + inPath
 	}
+
 	dir, _ := filepath.Split(inPath)
 
 	sectionCount := strings.Count(dir, FilePathSeparator)