a39
/
wiki
1
0
Fork 0
wiki/wiki.sh

22 lines
450 B
Bash
Raw Normal View History

2023-09-18 03:45:31 +00:00
#!/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