diff options
Diffstat (limited to 'scripts/acme/wikebab')
| -rwxr-xr-x | scripts/acme/wikebab | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/scripts/acme/wikebab b/scripts/acme/wikebab new file mode 100755 index 0000000..3ba5c6e --- /dev/null +++ b/scripts/acme/wikebab @@ -0,0 +1,24 @@ +#!/bin/zsh + +# Light version of getKebabCase which skips out on +# a bunch of things we have no idea how to code with +# sed regex, but aren't all too important for utility use. + +cat /dev/stdin | tr '[:upper:]' '[:lower:]' | sed \ + -r \ + -e 's/ /-/g' \ + -e 's/&/-and-/g' \ + -e 's/\+/-plus-/g' \ + -e 's/%/-percent-/g' \ + -e 's/(\b[^\s.-]{2,})\./$1-/g' \ + -e 's/\.([^\s.-]{2,})\b/-$1/g' \ + -e 's/[/@#$%*()_=,[\]{}|\\;:<>?`~]/-/g' \ + -e 's/[áâäàå]/a/g' \ + -e 's/[çč]/c/g' \ + -e 's/[éêëè]/e/g' \ + -e 's/[íîïì]/i/g' \ + -e 's/[óôöò]/o/g' \ + -e 's/[úûüù]/u/g' \ + -e 's/[^a-z0-9-]//g' \ + -e 's/-{2,}/-/g' \ + -e 's/^-+|-+$//g' \ No newline at end of file |