#!/bin/sh REQUEST_PATH="$(echo "$REQUEST_URI" | awk -F'?' '{ print $1 }' | ./urldecode.awk)" handler() { case "$1" in **.md) bin/md2html.awk "$1" ;; **.tpl) eval "$(bin/template.awk "$1")" ;; **) cat "$1" ;; esac } handler_body_main() { if [ -d "$SITE_DIR/$REQUEST_PATH" ]; then handler "$SITE_DIR/$REQUEST_PATH"/index.* elif [ -f "$SITE_DIR/$REQUEST_PATH".* ]; then handler "$SITE_DIR/$REQUEST_PATH".* fi } nav_tree() { find "$SITE_DIR" | sed -E -e "$DIR_FILTER s!^$SITE_DIR!!; $DIR_CLEAN" 2>&1 | sort -u | awk -v req_path="$REQUEST_PATH" -F/ ' function p(x, y, s) { for(i=0; i < x-y; i+=1) print s } BEGIN { lNF=2; print ""); print "" }' }