aboutsummaryrefslogtreecommitdiff
path: root/blogthis
diff options
context:
space:
mode:
authorPhilip Wittamore <philip@wittamore.com>2025-05-07 21:34:07 +0200
committerPhilip Wittamore <philip@wittamore.com>2025-05-07 21:34:07 +0200
commit66d9ecaa26925ffcc0947e887cc7a94f79268644 (patch)
treecde639475dfa226ad8d5353a7a5142fa23f0649b /blogthis
downloadblog-66d9ecaa26925ffcc0947e887cc7a94f79268644.tar.gz
blog-66d9ecaa26925ffcc0947e887cc7a94f79268644.tar.bz2
blog-66d9ecaa26925ffcc0947e887cc7a94f79268644.zip
blog scripts
Diffstat (limited to 'blogthis')
-rwxr-xr-xblogthis53
1 files changed, 53 insertions, 0 deletions
diff --git a/blogthis b/blogthis
new file mode 100755
index 0000000..c736c8f
--- /dev/null
+++ b/blogthis
@@ -0,0 +1,53 @@
+#!/bin/sh
+
+# create text, assemble html file, add to articles
+
+#web is a symlink to /home/philip/src/web/wittamore.com
+ROOT=/home/philip/web
+
+mkdir -p $ROOT/.tmp
+cd $ROOT/.tmp
+EDITFILE="middle.html"
+DATE=$(date +%Y-%m-%d)
+
+read -p "Enter title: " TITLE
+read -e -i "$DATE" -p "Enter date: " input
+read -p "Enter description: " DESCRIPTION
+
+ARTICLEDATE="${input:-$DATE}"
+YEAR=$(echo $ARTICLEDATE | cut -c 1-4)
+DEST="$ROOT/articles/$YEAR"
+
+echo "<h2>$TITLE</h2>" > $EDITFILE
+echo "<h5>$ARTICLEDATE</h5>" >> $EDITFILE
+echo "<h4>$DESCRIPTION</h4>" >> $EDITFILE
+
+micro +4:1 $EDITFILE
+
+FIXEDTITLE=${TITLE// /-}
+ARTICLE="$FIXEDTITLE.html"
+
+echo "<!doctype html>
+<html lang=\"EN\">
+ <head>
+ <meta charset=\"utf-8\">
+ <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">
+ <link rel=\"stylesheet\" href=\"/style.css\">
+ <title>$TITLE</title>
+ </head>
+ <body>
+ <header>
+ <h1>Bloggings</h1>
+ <a href=\"/index.php\">Back</a>
+ <hr>
+ </header>
+ <!-- article start -->" > $ARTICLE
+cat $EDITFILE >> $ARTICLE
+echo '<!-- article end -->
+<p>&nbsp;</p>
+<hr>
+<p>ยง</p>
+ </body>
+</html>' >> $ARTICLE
+mv $ARTICLE $DEST
+echo "saved as $DEST/$ARTICLE"