A bunch of stuff before breaking things up

This commit is contained in:
Uriel 2007-05-28 04:07:40 +02:00
parent 755893185a
commit 546713b0d6
9 changed files with 73 additions and 52 deletions

View file

@ -9,6 +9,8 @@ cd ..
# config
body=index
siteTitle=''
siteSubTitle=''
title=Title
template=default
sidebar=sidebar
@ -17,6 +19,7 @@ sidebar=sidebar
if (! ~ $#args 0 && ! ~ $args '') {
title=$args($#args)
title=`{echo $title | sed 's/_/ /' }
body=`{ echo -n $"args |sed 's, ,/,g' }
}
@ -36,9 +39,52 @@ if (test -d tpl/$body) {
body=`{echo tpl/^$"body^.md | sed 's, ,/,' }
# Sidebar
fn menu {
ls -F $1 | sed -e 's,^./,,' -e 's,\.md$,,' | grep -v '^_'| awk '
BEGIN { print "<ul class=\"sidebar\">" }
END { print "</ul>" }
/^([a-zA-Z0-9_\-]+[\/*]?)+$/ && ! /index$/ {
isdir = match($0, "/$")
sub("[*/]$", "") # The '*' makes no sense to me
if(isdir)
d = "/"
bname = $0
sub("^(.*/)?([0-9]+_)?", "", bname)
gsub("_", " ", bname)
bname = bname d
if(index(ENVIRON["REQUEST_URI"], "/" $0) == 1) {
if(isdir) {
print "<li><a href=\"/" $0 d "\">&raquo;<i> " bname "</i></a>"
system("rc -c ''menu " $0 "''")
} else {
print "<li><a href=\"/" $0 d "\" class=\"thisPage\">&raquo;<i> " bname "</i></a>"
}
} else
print "<li><a href=\"/" $0 d "\">&rsaquo; " bname "</a>"
print "</li>"
}'
}
fn gensidebar {
echo '<p class="sideBarTitle">Considered harmful:</p>'
cd tpl
menu .
cd ..
}
# Body
template.awk $template | rc
echo '<pre>'
#echo $"args
#env
# Debug junk
#echo '<pre>'
#env

1
bin/sidebar.tpl Normal file
View file

@ -0,0 +1 @@