#!/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'