From 4f7d98930dfc51165c4c026ccccc6f24d767d570 Mon Sep 17 00:00:00 2001 From: David Tomaschik Date: Wed, 11 Apr 2018 16:09:29 +0200 Subject: [PATCH] More improvements in slugs. --- dotfiles/zprezto_custom/jekyll/init.zsh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/dotfiles/zprezto_custom/jekyll/init.zsh b/dotfiles/zprezto_custom/jekyll/init.zsh index 08b2c42..2c3fb34 100644 --- a/dotfiles/zprezto_custom/jekyll/init.zsh +++ b/dotfiles/zprezto_custom/jekyll/init.zsh @@ -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