summaryrefslogtreecommitdiff
path: root/render.sh
diff options
context:
space:
mode:
Diffstat (limited to 'render.sh')
-rwxr-xr-xrender.sh17
1 files changed, 14 insertions, 3 deletions
diff --git a/render.sh b/render.sh
index 47cd89d..2ae2309 100755
--- a/render.sh
+++ b/render.sh
@@ -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