preserve alias case while lowercasing taxonomy

This commit is contained in:
Joel Scoble
2014-08-21 18:01:34 -05:00
committed by spf13
parent 348e123c9f
commit 4c735a7878
3 changed files with 35 additions and 3 deletions

View File

@@ -29,9 +29,18 @@ import (
var sanitizeRegexp = regexp.MustCompile("[^a-zA-Z0-9./_-]")
// Take a string with any characters and replace it so the string could be used in a path.
// E.g. Social Media -> social-media
// MakePath creates a Unicode sanitized string, with the spaces replaced, whilst
// preserving the original casing of the string.
// E.g. Social Media -> Social-Media
func MakePath(s string) string {
return UnicodeSanitize(strings.ToLower(strings.Replace(strings.TrimSpace(s), " ", "-", -1)))
return UnicodeSanitize(strings.Replace(strings.TrimSpace(s), " ", "-", -1))
}
// MakePathToLowerr creates a Unicode santized string, with the spaces replaced,
// 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)))
}
func MakeTitle(inpath string) string {