summaryrefslogtreecommitdiff
path: root/system/item
diff options
context:
space:
mode:
Diffstat (limited to 'system/item')
-rw-r--r--system/item/item.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/system/item/item.go b/system/item/item.go
index f6e8f99..99d70a8 100644
--- a/system/item/item.go
+++ b/system/item/item.go
@@ -258,6 +258,7 @@ func stringToSlug(s string) (string, error) {
str := strings.Replace(string(src), "'", "", -1)
str = strings.Replace(str, `"`, "", -1)
+ str = strings.Replace(str, "&", "-", -1)
t := transform.Chain(norm.NFD, transform.RemoveFunc(isMn), norm.NFC)
slug, _, err := transform.String(t, str)
@@ -267,3 +268,9 @@ func stringToSlug(s string) (string, error) {
return strings.TrimSpace(slug), nil
}
+
+// NormalizeString removes and replaces illegal characters for URLs and other
+// path entities. Useful for taking user input and converting it for keys or URLs.
+func NormalizeString(s string) (string, error) {
+ return stringToSlug(s)
+}