Fix bugs
Allow users to use other editors grep for more info to match not just the title alone. Remove slashes in titles
This commit is contained in:
parent
3a7cdeb1ff
commit
0865e9de10
7
lb
7
lb
|
@ -33,11 +33,12 @@ listandReturn() { \
|
|||
getTitle() { \
|
||||
echo "Post will be stored as draft in $draftdir until finalized."
|
||||
read -rp "Give a title for your post: " title
|
||||
title=$(echo "$title" | tr -d '[=/=]' | tr -d '[=\=]')
|
||||
url=$(echo "$title" | tr -d '[:punct:]' | tr " " "-" | tr '[:upper:]' '[:lower:]')
|
||||
|
||||
[ -z $url ] && echo "Error: Empty title!" && return 0;
|
||||
|
||||
grep "$url" "$blogfile" &>/dev/null && lbdupnum=1 && while [ grep "$url" "$blogfile" ]; do lbdupnum=$((lbdupnum+1)); done
|
||||
grep "id='$url'" "$blogfile" &>/dev/null && lbdupnum=1 && while [ grep "$url" "$blogfile" ]; do lbdupnum=$((lbdupnum+1)); done
|
||||
[ ! -z ${lbdupnum+x} ] && url="$url"-"$lbdupnum"
|
||||
return 0
|
||||
}
|
||||
|
@ -51,7 +52,7 @@ postNew() { \
|
|||
|
||||
finalize() { \
|
||||
url=$(grep -o "<h2 id='\(.\)*'>" "$draftdir"/"$chosen" | cut -d "'" -f2)
|
||||
title=$(grep -o "<h2 id='\(.\)*h2>" "$draftdir"/"$chosen" | sed -e 's/<[^>]*>//g')
|
||||
title=$(grep -o "<h2 id='\(.\)*h2>" "$draftdir"/"$chosen" | sed -E 's/<[^>]*>//g')
|
||||
echo "AddDescription \"$title\" $chosen" >> "$blogdir"/.htaccess
|
||||
rssdate=$(date '+%a, %d %b %Y %H:%M:%S %z')
|
||||
webdate=$(date '+%a, %d %b %Y %H:%M:%S %z')
|
||||
|
@ -90,6 +91,6 @@ case "$1" in
|
|||
discard) listandReturn "$draftdir/*.html" discard && discard ;;
|
||||
finalize) listandReturn "$draftdir" finalize && finalize ;;
|
||||
delete) listandReturn "$blogdir/*.html" delete && delete ;;
|
||||
edit) listandReturn "$draftdir/*.html" edit && vim "$chosen" ;;
|
||||
edit) listandReturn "$draftdir/*.html" edit && $EDITOR "$chosen" ;;
|
||||
*) getHelp ;;
|
||||
esac
|
||||
|
|
Loading…
Reference in New Issue