hugo

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

git clone git://git.shimmy1996.com/hugo.git
commit 1684579127630853bef5637e116c68dffe33f59c
parent 5dd3eaabee80cbf92913522364ef52f26f3269cd
Author: Jakub Turski <yacoob@gmail.com>
Date:   Wed,  3 Sep 2014 20:05:44 +0100

Go back to lowercase slugs. Also, use MakePathToLower in TestMakeToLower.

go fmt

Diffstat:
Mhelpers/helpers_test.go | 13++++++++-----
Mhelpers/path.go | 2+-
Mhelpers/url.go | 2+-
3 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/helpers/helpers_test.go b/helpers/helpers_test.go
@@ -1,8 +1,9 @@
 package helpers
 
 import (
-	"github.com/stretchr/testify/assert"
 	"testing"
+
+	"github.com/stretchr/testify/assert"
 )
 
 func TestPretty(t *testing.T) {
@@ -45,8 +46,8 @@ func TestMakePath(t *testing.T) {
 		{"fOO,bar:foo%bAR", "fOObarfoobAR"},
 		{"FOo/BaR.html", "FOo/BaR.html"},
 		{"трям/трям", "трям/трям"},
-		{"은행","은행"},
-		{"Банковский кассир","Банковский-кассир"},
+		{"은행", "은행"},
+		{"Банковский кассир", "Банковский-кассир"},
 	}
 
 	for _, test := range tests {
@@ -63,15 +64,16 @@ func TestMakeToLower(t *testing.T) {
 		expected string
 	}{
 		{"  foo bar  ", "foo-bar"},
+		{"  Foo Bar  ", "foo-bar"},
 		{"foo.bar/foo_bar-foo", "foo.bar/foo_bar-foo"},
 		{"foo,bar:foo%bar", "foobarfoobar"},
 		{"foo/bar.html", "foo/bar.html"},
 		{"трям/трям", "трям/трям"},
-		{"은행","은행"},
+		{"은행", "은행"},
 	}
 
 	for _, test := range tests {
-		output := MakePath(test.input)
+		output := MakePathToLower(test.input)
 		if output != test.expected {
 			t.Errorf("Expected %#v, got %#v\n", test.expected, output)
 		}
@@ -84,6 +86,7 @@ func TestUrlize(t *testing.T) {
 		expected string
 	}{
 		{"  foo bar  ", "foo-bar"},
+		{"Foo And BAR", "foo-and-bar"},
 		{"foo.bar/foo_bar-foo", "foo.bar/foo_bar-foo"},
 		{"foo,bar:foo%bar", "foobarfoobar"},
 		{"foo/bar.html", "foo/bar.html"},
diff --git a/helpers/path.go b/helpers/path.go
@@ -40,7 +40,7 @@ func MakePath(s string) string {
 // and transformed to lower case.
 // E.g. Social Media -> social-media
 func MakePathToLower(s string) string {
-        return UnicodeSanitize(strings.ToLower(strings.Replace(strings.TrimSpace(s), " ", "-", -1)))
+	return UnicodeSanitize(strings.ToLower(strings.Replace(strings.TrimSpace(s), " ", "-", -1)))
 }
 
 func MakeTitle(inpath string) string {
diff --git a/helpers/url.go b/helpers/url.go
@@ -35,7 +35,7 @@ func SanitizeUrl(in string) string {
 //     uri: Vim (text editor)
 //     urlize: vim-text-editor
 func Urlize(uri string) string {
-	sanitized := MakePath(uri)
+	sanitized := MakePathToLower(uri)
 
 	// escape unicode letters
 	parsedUri, err := url.Parse(sanitized)