#!/bin/bash # render.sh: part of the tape-and-string framework. # v3.1 enable -f /usr/lib/bash/csv csv declare -A title while read -r ii; do csv -a i "$ii" title[in/${i[0]}]=${i[1]} done $o" if test -z "${title[$i]}"; then tape $i | m4 m4/main.html.m4 > ${o%.*}.html else tape $i | m4 -DTITLE="${title[$i]}" m4/main.html.m4 > ${o%.*}.html fi done } function sass { inf "Rendering sass files..." if test -z "${sass[@]}"; then inf "No .sass files detected, skipping" unset sass else for i in ${sass[@]}; do o="${i/in/out}" echo "$i => $o" sassc -a $i ${o/sa/c} done fi if test -z "${scss[@]}"; then inf "No .scss files detected, skipping." unset scss else for i in ${scss[@]}; do o="${i/in/out}" echo "$i => $o" sassc $i ${o#s} done fi } function other { inf "Copying other files..." cp -rv 'in'/* out/ } function all { dirs docs sass other } if test -z "$*"; then all exit 0 fi case $1 in dir) dirs;; doc) docs;; s[ac]ss) sass;; other) other;; all) all;; *) all;; esac