#!/bin/bash

set -e


# Ensure we are in the right place
SCRIPT_DIR="$(cd -P -- "$(dirname -- "$0")" && pwd -P)"
cd $SCRIPT_DIR

# Render templates
for item in index.html list.html post.html page.html
do 
    echo $item
    value=`cat $item`
    value=$(echo ${value} | sed -e "s#/#\\\/#g")
    cp base.html "out/$item"
    sed -i "s/MAIN/$value/g" "out/$item"
done

# Copy static files
cp *.css out/
