diff options
Diffstat (limited to 'render.sh')
-rwxr-xr-x | render.sh | 17 |
1 files changed, 14 insertions, 3 deletions
@@ -1,4 +1,13 @@ set -ex; + +function injectTemplate { + tmpl=$1 + dest=$2 + key=$(basename ${tmpl} .html) + sed -i "/[{]${key}[}]/r ${tmpl}" $dest + sed -i "s/[{]${key}[}]//g" $dest +} + if [ $# -ne 2 ]; then echo "Usage: ./render.sh <file> www/<path>/<to>/<prod>.html" exit 1; @@ -11,9 +20,11 @@ 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 + injectTemplate $tmpl $DEST +done +for tmpl in entries/*.html; do + injectTemplate $tmpl $DEST done + ./tidy.sh $DEST |