#!/bin/bash # Time-stamp: # Version 0.3 # blogjob by Joe Galaxy # the simpliest blog engine ever EDITOR="emacs -nw" NOW="`date +%s`" BDIR="$HOME/stixx" RAW="$BDIR/.raw.$NOW" TITLE="/tmp/title.$NOW" POST="$BDIR/.post.$NOW" HEAD="$BDIR/head.tmpl" CONT="$BDIR/cont.tmpl" FOOT="$BDIR/foot.tmpl" if [ ! -d $BDIR ]; then mkdir "$BDIR" fi if (($#!=1)); then echo "usage:" echo -e "\tblogjob 'Post Title'" exit 1 else echo "$1" > "$TITLE" $EDITOR $RAW echo "" > $POST echo "

`cat $TITLE`

" >> $POST echo "

`cat $RAW`

" >> $POST echo "

`date +'%Y-%m-%dT%H:%M:%SZ'` \ | $NOW | raw

" >> $POST echo "" >> $POST echo "" >> $POST cat $HEAD > $BDIR/index.html awk '{print}' `ls -r $BDIR/.post.*` >> $BDIR/index.html cat $FOOT >> $BDIR/index.html # Optional tidy -asxhtml -i -utf8 -m $BDIR/index.html bj2atom > $BDIR/atom.xml # bj2twitter # tw is something like: # tw() { # curl -u "username:password" -d status="$*" -d source="blogjob" http://twitter.com/statuses/update.xml # } tw "`sed -e 's/<[^>]*>//g' $RAW`" rm $TITLE fi