important fixes!

This commit is contained in:
Luke Smith 2018-12-14 12:36:56 -05:00
parent 197624ebfa
commit 85c0d07b20
No known key found for this signature in database
GPG Key ID: 4C50B54A911F6252
1 changed files with 3 additions and 3 deletions

6
lb
View File

@ -24,8 +24,8 @@ newpost() { read -erp "Give a title for your post:
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 ' ' '-')"
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."
[ -f "$webdir/blog/$url.html" ] && echo "There is already an existing published entry of that same name/URL."
[ -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
$EDITOR "$webdir/blog/.drafts/$url.html" ;}
listandReturn() { printf "Listing contents of %s.\\n" "$1"
@ -45,7 +45,7 @@ publish() { \
printf "<html>\\n<head>\\n<title>%s</title>\\n<link rel='stylesheet' type='text/css' href='%s'>\\n<meta charset='utf-8'/>\\n</head>\\n<body>\\n<h1>%s</h1>\\n<small>[<a href='%s#%s'>link</a>&mdash;<a href='%s'>standalone</a>]</small>\\n%s\\n<footer>by <strong><a href='%s'>%s</a></strong></footer>\\n</body>\\n\\n</html>" "$realname" "$css" "$realname" "../$blogfile" "$base" "$basefile" "$(cat "$webdir/blog/.drafts/$basefile")" "$website" "$name" > "$webdir/blog/$basefile"
printf "\\n<item>\\n<title>%s</title>\\n<guid>%s%s#%s</guid>\\n<pubDate>%s</pubDate>\\n<description><![CDATA[\\n%s\\n]]></description>\\n</item>\\n\\n" "$realname" "$website" "$blogfile" "$basefile" "$rssdate" "$(cat "$webdir/blog/.drafts/$basefile")" > "$tmpdir/rss"
printf "<div class='entry'>\\n<h2 id='%s'>%s</h2>\\n<small>[<a href='#%s'>link</a>&mdash;<a href='%s'>standalone</a>]</small>\\n%s\\n<small>%s</small>\\n</div>\\n" "$base" "$realname" "$base" "blog/$basefile" "$(cat "$webdir/blog/.drafts/$basefile")" "$webdate" > "$tmpdir/html"
printf "<li>%s &ndash; <a href=\"blog/%s\">%s</a></li>" "$(date '+%Y %b %d')" "$basefile" "$realname" > "$tmpdir/index"
printf "<li>%s &ndash; <a href=\"blog/%s\">%s</a></li>\\n" "$(date '+%Y %b %d')" "$basefile" "$realname" > "$tmpdir/index"
sed -i "/<!-- LB -->/r $tmpdir/html" "$blogfile"
sed -i "/<!-- LB -->/r $tmpdir/rss" "$rssfile"
sed -i "/<!-- LB -->/r $tmpdir/index" "$indexfile"