lb

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

commit 58d485eda69353f1590a8e62ac0c82fd7e03070b
parent 517d0fe0b5d39667f709a866a7abe20274a30d23
Author: Luke Smith <luke@lukesmith.xyz>
Date:   Mon,  3 Sep 2018 19:39:22 -0400

big fix

Diffstat:
Mlb | 6++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lb b/lb @@ -32,14 +32,16 @@ listandReturn() { \ getTitle() { \ echo "Post will be stored as draft in $draftdir until finalized." read -rp "Give a title for your post: " title - url=$(echo $title | sed -e "s/'\|\"\|=\|+\|_\|,\|\.\|:\|;\|?\|!\|@\|\*\|&\|(\|)\|[\|]\|<\|>//g;s/ /-/g" | tr '[:upper:]' '[:lower:]') + url=$(echo "$title" | tr -d '[:punct:]' | tr " " "-" | tr '[:upper:]' '[:lower:]') grep "$url" "$blogfile" &>/dev/null && lbdupnum=1 && while [ grep "$url" "$blogfile" ]; do lbdupnum=$((lbdupnum+1)); done [ ! -z ${lbdupnum+x} ] && url="$url"-"$lbdupnum" + return 0 } postNew() { \ mkdir -p "$draftdir" - echo -e "<h2 id='$url'>$title</h2>\n<small>[<a href=\"$blogfile#$url\">link</a>&mdash;<a href=\"blog/$url.html\">standalone</a>]</small>\n\n<++>" >> "$draftdir"/$url.html && $EDITOR "$draftdir"/$url.html ;} + echo -e "<h2 id='$url'>$title</h2>\n<small>[<a href=\"$blogfile#$url\">link</a>&mdash;<a href=\"blog/$url.html\">standalone</a>]</small>\n\n<++>" >> "$draftdir"/$url.html && $EDITOR "$draftdir"/$url.html + } finalize() { \ listandReturn "$draftdir" finalize