#!/bin/bash
# $Id: update-htmlfiles 5897 2009-04-02 14:15:38Z goodger $
#
# Expect list of htmlfiles freshen with rst2html if there is
# a newer txt file besides.
# Used to initialise a docutils-update upload directory.
cat $1 | \
while read F ; do
if test ${F: -4} == ".txt" ; then
TXT=$F
HTML=${F/\.txt/\.html}
elif test ${F: -5} == ".html" ; then
TXT=${F/\.html/\.txt}
HTML=$F
else
TXT=""
fi
if test -n "$TXT" ; then
if test -e "$TXT" -a "$TXT" -nt "$HTML" ; then
echo "Building $HTML from $TXT"
rst2html.py $TXT $HTML
fi
else
echo "Do not know what to do about: $F"
fi
done