set -ex; if [ $# -ne 2 ]; then echo "Usage: ./render.sh www///.html" exit 1; fi FILE=$1 DEST=$2 mkdir -p $(dirname $DEST) cp $FILE $DEST for tmpl in templates/*.html; do key=$(basename ${tmpl} .html) sed -i "/[{]${key}[}]/r ${tmpl}" $DEST sed -i "s/[{]${key}[}]//g" $DEST done ./tidy.sh $DEST