A couple of minor code simplifications and add a comment about some code that probably should be killed.
This commit is contained in:
parent
4cd62ee394
commit
6095d57ab8
11
bin/werc.rc
11
bin/werc.rc
@ -36,12 +36,14 @@ fn gensidebar {
|
|||||||
dirs = ( $sitedir^$dd $dirs )
|
dirs = ( $sitedir^$dd $dirs )
|
||||||
}
|
}
|
||||||
# Ignore stderr, last item in path might be a file that doesn't exist (eg., foo for foo.md)
|
# Ignore stderr, last item in path might be a file that doesn't exist (eg., foo for foo.md)
|
||||||
ls -F $dirs >[2]/dev/null | sed 's/\*$//; s,^'$sitedir',,; '^$dirfilter^' s,^/,,'|sort -u | awk -F/ '
|
ls -F $dirs >[2]/dev/null | sed 's/\*$//; s,^'$sitedir',,; '^$dirfilter | sort -u | awk -F/ '
|
||||||
function p(x, y, s) {
|
function p(x, y, s) {
|
||||||
for( i=0; i < x-y; i+=1)
|
for( i=0; i < x-y; i+=1)
|
||||||
print s
|
print s
|
||||||
}
|
}
|
||||||
/^([a-zA-Z0-9+_\-]+[*\/]?)+$/ {
|
|
||||||
|
# XXX Regexp to hide non-document/non-dir stuff, there must be a better way, if we really want this.
|
||||||
|
/^\/([a-zA-Z0-9+_\-]+[*\/]?)+$/ {
|
||||||
|
|
||||||
d = ""
|
d = ""
|
||||||
if(match($0, "/$"))
|
if(match($0, "/$"))
|
||||||
@ -53,7 +55,7 @@ fn gensidebar {
|
|||||||
lNF = NF
|
lNF = NF
|
||||||
|
|
||||||
bname = $NF d
|
bname = $NF d
|
||||||
path = "/" $0 d
|
path = $0 d
|
||||||
gsub("_", " ", bname)
|
gsub("_", " ", bname)
|
||||||
|
|
||||||
if(index(ENVIRON["REQUEST_URI"] "/", path) == 1)
|
if(index(ENVIRON["REQUEST_URI"] "/", path) == 1)
|
||||||
@ -69,8 +71,7 @@ fn gensidebar {
|
|||||||
# Handlers
|
# Handlers
|
||||||
fn set_handler {
|
fn set_handler {
|
||||||
handler = $1
|
handler = $1
|
||||||
shift
|
handler_args = $*(2-)
|
||||||
handler_args = $*
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn md_handler { cat $* | $formatter }
|
fn md_handler { cat $* | $formatter }
|
||||||
|
Loading…
Reference in New Issue
Block a user