#!/bin/bash PAGE=${REQUEST_URI#/} if [ -z $PAGE ] then PAGE=$INDEX fi http_header () { echo HTTP/1.0 $@ echo } pandoc="pandoc -f gfm -t html -s --template=$TEMPLATE -V title-prefix:$SITE_TITLE -V pagetitle:$PAGE" git cat-file -e HEAD:"$PAGE".md if [ $? == 0 ] then http_header 200 OK git show HEAD:"$PAGE".md | $pandoc else http_header 404 Not found echo "This page does not exist. [Click here]($REPO_URL/wiki/$PAGE?action=_new) to create it." | $pandoc fi