aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Wittamore <philip@wittamore.com>2026-06-16 09:47:17 +0200
committerPhilip Wittamore <philip@wittamore.com>2026-06-16 09:47:17 +0200
commit06787773182125e4a958b597dc75e5e2ae02a4ac (patch)
tree0c3dadf8f905d5b79cbd919bf9568aadfaf24daa
parentd9dfd86749c3fe0ce16b74d31c41ddd46548ec23 (diff)
update
-rwxr-xr-xblogthis25
1 files changed, 19 insertions, 6 deletions
diff --git a/blogthis b/blogthis
index fbb3155..43e4e51 100755
--- a/blogthis
+++ b/blogthis
@@ -7,8 +7,10 @@ ROOT="$HOME/web"
mkdir -p $ROOT/.tmp
cd $ROOT/.tmp || exit
+rm *
EDITTMP="tmp.txt"
EDITHTM="tmp.html"
+HEADTMP="top.html"
DATE=$(date +%Y-%m-%d)
read -r -p "Enter title: " TITLE
@@ -19,14 +21,21 @@ ARTICLEDATE="${input:-$DATE}"
YEAR=$(echo "$ARTICLEDATE" | cut -c 1-4)
DEST="$ROOT/articles/$YEAR"
-echo "<h2>$TITLE</h2>" > $EDITTMP
-echo "<h5>$ARTICLEDATE</h5>" >> $EDITTMP
-echo "<h4>$DESCRIPTION</h4>" >> $EDITTMP
-echo -e "<p>&nbsp;</p>\n" >> $EDITTMP
+# build header
+echo "<h2>$TITLE</h2>" > "$HEADTMP"
+echo "<h5>$ARTICLEDATE</h5>" >> "$HEADTMP"
+echo "<h4>$DESCRIPTION</h4>" >> "$HEADTMP"
+echo "<br>" >> "$HEADTMP"
+# write article
micro +6:1 "$EDITTMP"
+
+# concatenate
md2html -o "$EDITHTM" "$EDITTMP"
+cat "$EDITHTM" >> "$HEADTMP"
+mv "$HEADTMP" "$EDITHTM"
+# build final html article
FIXEDTITLE=${TITLE// /-}
ARTICLE="$FIXEDTITLE.html"
@@ -57,12 +66,16 @@ echo " </article>
</body>
</html>" >> "$ARTICLE"
-prettier --write "$ARTICLE"
mv "$ARTICLE" "$DEST"
+#tidy -m --tidy-mark no "$DEST/$ARTICLE"
+prettier --write "$DEST/$ARTICLE"
-echo "saved as $DEST/$ARTICLE"
+clear
+cat "$DEST/$ARTICLE"
echo "--------------------------"
+echo "saved as $DEST/$ARTICLE"
+
read -rp "Update the sitemap and rss feed, then upload to your server? ; " choix
if [ "$choix" != "n" ] ; then