blogthis 645 B

12345678910111213141516171819202122232425262728293031
  1. #!/bin/sh
  2. # create text, assemble html file, add to articles
  3. #requires package html-xml-utils for hxselext
  4. ROOT=/home/philip/src/web/wittamore.com
  5. cd $ROOT/.tmp
  6. TOP="top.html"
  7. BOTTOM="bottom.html"
  8. EDITFILE="middle.html"
  9. DATE=$(date +%Y-%m-%d)
  10. read -p "Enter title: " TITLE
  11. read -e -i "$DATE" -p "Enter date: " input
  12. ARTICLEDATE="${input:-$DATE}"
  13. YEAR=$(echo $ARTICLEDATE | cut -c 1-4)
  14. DEST="$ROOT/articles/$YEAR"
  15. echo "<h2>$TITLE</h2>" > $EDITFILE
  16. echo "<h5>$ARTICLEDATE</h5>" >> $EDITFILE
  17. micro $EDITFILE
  18. TITLE=${TITLE// /-}
  19. ARTICLE="$TITLE.html"
  20. cat $TOP $EDITFILE $BOTTOM > $ARTICLE
  21. mv $ARTICLE $DEST
  22. echo "saved as $DEST/$ARTICLE"