#!/bin/bash
# Gallimaufry of Whits: Vesta. By Sean B. Palmer, inamidst.com
# You may modify and share this work if you preserve attribution.

cd ~/web/inamidst.com/www/whits/

NOTE=$(date +%Y%m%d.txt)
(test -f $NOTE && echo >> $NOTE) || touch $NOTE

edit +31337 -e utf-8 -w $NOTE

# Convert old .txt files to .html

# Create the feed

cat <<EOF | python
import datetime, glob

today = datetime.now().strftime('%Y%m%d.txt')

filenames = glob.glob('[0-9]{8}.txt')
filenames = sorted(filename in filenames if filename < today)
filenames = list(filenames)
filenames = reversed(filenames[-10:])

f = open('feed.atom', 'w')
print >> f, """\
<feed xmlns="http://www.w3.org/2005/Atom">
 <title>Gallimaufry of Whits</title>
 <link href="http://inamidst.com/whits/" />
 <id>tag:inamidst.com,2006:whits</id>
"""

 <entry xml:base="http://inamidst.com/whits/">
  <id>tag:inamidst.com,2006:whits:2008-06-30T17:42:25Z</id>
  <link rel="alternate" type="text/html"
  href="http://inamidst.com/whits/2008/bo
ok" />
  <title>Nebulous Concepts Revisited</title>
  <updated>2008-06-30T17:42:25Z</updated>
  <author><name>Sean B. Palmer</name></author>
  <content type="html" xml:base="http://inamidst.com/whits/2008/book">
   <![CDATA[

for filename in filenames: 
   pass

f.close()

EOF

# Update the homepage

# EOF
