|
@@ -0,0 +1,31 @@
|
|
|
+#!/bin/sh
|
|
|
+
|
|
|
+# create text, assemble html file, add to articles
|
|
|
+#requires package html-xml-utils for hxselext
|
|
|
+
|
|
|
+ROOT=/home/philip/src/web/wittamore.com
|
|
|
+
|
|
|
+cd $ROOT/.tmp
|
|
|
+TOP="top.html"
|
|
|
+BOTTOM="bottom.html"
|
|
|
+EDITFILE="middle.html"
|
|
|
+DATE=$(date +%Y-%m-%d)
|
|
|
+
|
|
|
+read -p "Enter title: " TITLE
|
|
|
+read -e -i "$DATE" -p "Enter date: " input
|
|
|
+
|
|
|
+ARTICLEDATE="${input:-$DATE}"
|
|
|
+YEAR=$(echo $ARTICLEDATE | cut -c 1-4)
|
|
|
+DEST="$ROOT/articles/$YEAR"
|
|
|
+
|
|
|
+echo "<h2>$TITLE</h2>" > $EDITFILE
|
|
|
+echo "<h5>$ARTICLEDATE</h5>" >> $EDITFILE
|
|
|
+
|
|
|
+micro $EDITFILE
|
|
|
+
|
|
|
+TITLE=${TITLE// /-}
|
|
|
+ARTICLE="$TITLE.html"
|
|
|
+
|
|
|
+cat $TOP $EDITFILE $BOTTOM > $ARTICLE
|
|
|
+mv $ARTICLE $DEST
|
|
|
+echo "saved as $DEST/$ARTICLE"
|