#!/bin/bash ####################################################### # begin config section Default=index Src=${Src='http://www.unbox.org/open/trunk/573/13/fall/doc'} Cat=${Cat=' wget -q -O - '} Markdown=${Markdown:='/home/stuff/env/bin/markdown_py'} Files='index.cgi' header() { cat<<-EOF $1 EOF } # end config section ######################################################### # from here down, you should not need to change anything Q=${QUERY_STRING:=$Default} Q=$(echo $Q | sed 's/[^\/\.0-9a-zA-Z]//g') auk2md() { cat </,/<\/pre>/ { gsub(/<[\/]?code>/,"") gsub(Pat, "&") gsub(/"[^"]*"/,"&") gsub(/#.*/, "&") gsub(/[{}]/, "&") } { print $0 } ' } echo "Content-type: text/html" echo "" if [ "$Q" = "REFRESH" ] then for i in $Files; do wget -q -O - $Src/$i > $i done chmod 755 index.cgi echo "
"; echo ""; date
    cksum  $Files
    echo "`cat $Files | cksum` TOTAL"
    echo 'Continue.'
else
    header $Q
    $Cat $Src/header.html
    if [[ "$Q" =~ .*auk$ ]]
    then $Cat $Src/$Q | auk2md $Q
    else $Cat $Src/${Q}.md 
    fi | $Markdown | pre
    $Cat $Src/footer.html
fi