lb

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 56d3bb8c46c9d15ca5ccc3c8cdb4f23757836af8
parent b879d3485739425cc5e945e8879be1e538cd4c97
Author: Luke Smith <luke@lukesmith.xyz>
Date:   Sat,  2 Feb 2019 07:15:35 -0500

url handles (removes) emojis and accented chars

Diffstat:
Mlb | 2+-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lb b/lb @@ -21,7 +21,7 @@ fi newpost() { read -erp "Give a title for your post: " title echo "$title" | grep "\"" >/dev/null && printf "Double quotation marks (\") are not allowed in entry titles.\\n" && exit - url="$(echo "$title" | tr -d '[:punct:]' | tr '[:upper:]' '[:lower:]' | tr ' ' '-')" + url="$(echo "$title" | iconv -cf UTF-8 -t ASCII//TRANSLIT | tr -d '[:punct:]' | tr '[:upper:]' '[:lower:]' | tr ' ' '-' | sed "s/-\+/-/g;s/\(^-\|-\$\)//g")" echo "AddDescription \"$title\" \"$url.html\"" >> "$webdir/blog/.htaccess" || { echo "Error: Is htaccess writeable?"; exit; } [ -f "$webdir/blog/.drafts/$url.html" ] && echo "There is already an existing draft entry of that same name/URL." && exit [ -f "$webdir/blog/$url.html" ] && echo "There is already an existing published entry of that same name/URL." && exit