#!/bin/bash SITE_TITLE="Volpeon's Den" target () { echo "dist/$(echo ${1%.md}.html | cut -sd / -f 2-)" } compile () { TARGET=$(target "$1") mkdir -p $(dirname "$TARGET") pandoc "$1" \ -t html5 \ --template templates/base.html \ -o "$TARGET" \ --metadata sitetitle="$SITE_TITLE" } if [ -z "$1" ]; then find content/ \ -iname "*.md" \ -type f \ | while read FILE do compile "$FILE" done else if [ "$2" = "delete" ]; then rm $(target $1) else compile "$1" fi fi