aboutsummaryrefslogtreecommitdiffstats
path: root/skate/slugify.go
diff options
context:
space:
mode:
Diffstat (limited to 'skate/slugify.go')
-rw-r--r--skate/slugify.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/skate/slugify.go b/skate/slugify.go
new file mode 100644
index 0000000..e8fa8bf
--- /dev/null
+++ b/skate/slugify.go
@@ -0,0 +1,18 @@
+package skate
+
+import (
+ "bytes"
+ "fmt"
+ "strings"
+)
+
+// slugifyString is a basic string slugifier.
+func slugifyString(s string) string {
+ var buf bytes.Buffer
+ for _, c := range strings.TrimSpace(strings.ToLower(s)) {
+ if (c > 96 && c < 123) || (c > 47 && c < 58) || (c == 32) || (c == 9) || (c == 10) {
+ fmt.Fprintf(&buf, "%c", c)
+ }
+ }
+ return strings.Join(strings.Fields(buf.String()), " ")
+}