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