initial import of changes from 9front bikeshedding; bundle rc-httpd

This commit is contained in:
Stanley Lieber 2016-02-04 15:05:05 -05:00
parent 6d3bcc867c
commit a99fa8b44f
46 changed files with 1061 additions and 572 deletions

13
bin/corehandlers.rc Normal file → Executable file
View file

@ -75,9 +75,9 @@ fn dir_listing_handler {
d=`{basename -d $1}
if(~ $#d 0)
d='/'
echo $d|sed 's,.*//,,g; s,/$,,; s,/, / ,g; s/[\-_]/ /g; s,.*,<h1 class="dir-list-head">&</h1> <ul class="dir-list">,'
echo $d|sed 's,.*//,,g; s,/$,,; s,/, / ,g; s,.*,<h1 class="dir-list-head">&</h1> <ul class="dir-list">,'
# Symlinks suck: '/.' forces ls to list the linked dir if $d is a symlink.
ls -F $dir_listing_ls_opts $sitedir$d/. | sed $dirfilter$dirclean | awk '{match($0, "/[^/]*/?$"); l=substr($0, RSTART+1, RLENGTH-1);n=l; gsub(/[\-_]/, " ", n); print "<li><a href=\""l"\">"n"</a></li>"; }' | uniq
ls -F $dir_listing_ls_opts $sitedir$d/. | sed $dirfilter$dirclean' s,.*/([^/]+/?)$,<li><a href="\1">\1</a></li>,'
echo '</ul>'
}
@ -121,13 +121,8 @@ fn setup_handlers {
# Dir listing
if not if(~ $local_path */index) {
handler_body_main=(dir_listing_handler $req_path)
if(test -f $sitedir$req_path'_header.md') {
t=`{get_file_title $sitedir$req_path'_header.md'}
if(! ~ $"t '')
pageTitle=$t
ll_add handlers_body_head md_handler $sitedir$req_path'_header.md'
}
if(test -f $sitedir$req_path'_header.md')
ll_add handlers_body_head md_handler $sitedir$req_path'_header.md'
if(test -f $sitedir$req_path'_footer.md')
ll_add handlers_body_foot md_handler $sitedir$req_path'_footer.md'
}