ref: 87bb47145bb65c9fc656a71fdcbed62d6a7a6f81
dir: /werc/ls/app.rc/
fn ls_init{ handler_body_main=(ls_body $req_path) } fn ls_body{ d=`{basename -d $1} if(~ $#d 0) d='/' if(test -f $sitedir$d/index.md){ $formatter $sitedir$d/index.md echo '<ul class="dir-list">' } if not{ echo $d | sed 's,.*//,,g; s,/$,,; s,/, / ,g; s,.*,<h1 class="dir-list-head">&</h1> <ul class="dir-list">,' echo '<a href="../">..</a><br>' } echo '<table border="0"><tr><th>size<th>last modified<th>name</tr>' ls -Fl $sitedir$d | sed $dirclean'/_werc/d;/[\/ ]_/d;/index/d;s/^[^ ]+ [^ ]+ [^ ]+ [^ ]+ [^ ]+ +//;s/^([^ ]+) (.*) [^ ]+\/([^''\/\* ]+\/?)''?(\*?)$/<tr><td>\1<td>\2<td><a href="\3">\3\4<\/a><\/tr>/' echo '</table></ul>' }