summaryrefslogtreecommitdiff
path: root/render.sh
blob: 47cd89df90ac554d4981540aab9299b4f6a387b3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
set -ex;
if [ $# -ne 2 ]; then
    echo "Usage: ./render.sh <file> www/<path>/<to>/<prod>.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