More improvements in slugs.

This commit is contained in:
David Tomaschik
2018-04-11 16:09:29 +02:00
parent 1aa256252f
commit 4f7d98930d

View File

@@ -74,7 +74,12 @@ function jekyll {
JTEMPLATE+="category: Blog\n"
JTEMPLATE+="---\n\n"
TITLE=${@[2,-1]}
SLUG=$(echo -n ${TITLE}|tr A-Z a-z|tr -c -s -- a-z0-9 -|sed 's/^-*\([^-].*[^-]\)-*$/\1/')
SLUG=$(echo -n ${TITLE} |
tr A-Z a-z | # Everything in lower case
tr -d "'" | # Remove single quotes entirely
tr -c -s -- a-z0-9 - | # Replace non-alphanums with dashes
sed 's/^-*\([^-].*[^-]\)-*$/\1/' # Remove leading and trailing slashes
)
DATE=`date +%Y-%m-%d`
case "${1:-help}" in