#!/bin/sh
blogfile="./blogs"
outfile="./blogs/output"
index="./blogs/output/index.html"
mkdir -p $outfile
rm -rf outfile/*.html
echo """
Thing1's blogs!
""" > $index
blogs=$(ls $blogfile/*.blog)
for i in $blogs; do
out=$(echo $i | rev | cut -d '/' -f 1 | cut -d '.' -f 2- | rev)
echo """
${out}
$out
""" > $outfile/$out.html
cat $i | ./blogtohtml >> $outfile/$out.html
echo """
""" >> $outfile/$out.html
echo "${out}" >> $index
done