swerc

anselm's simpler werc fork
git clone git://git.suckless.org/swerc
Log | Files | Refs | README

commit 707f1fc6b5e39bbc9b966cabe451e7e9f316f985
parent acdb3fcd014e84372a8bf752b2ef98b8281d2d20
Author: uriel@engel.se.cat-v.org <unknown>
Date:   Sun,  8 Mar 2009 23:58:49 +0100

New api to allow 'synthetic' dirs, only for sidebar for now.
Diffstat:
Mbin/corehandlers.rc | 11+++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/bin/corehandlers.rc b/bin/corehandlers.rc @@ -1,13 +1,20 @@ # Werc builtin handlers +# API +fn add_synth_paths { + synth_paths=($synth_paths $conf_wd^$*) +} + fn nav_tree { if(! ~ $#sideBarNavTitle 0) echo '<p class="sideBarTitle">'$"sideBarNavTitle':</p>' # Ignore stderr, last path element might be a file that doesn't exist (eg., foo for foo.md) # /./ to deal with p9p's ls failure to follow dir symlinks otherwise ls -F $sitedir/./$req_paths_list >[2]/dev/null \ - | sed $dirfilter'/\/[^_.\/][^\/]*(\.(md|txt|html)|\/)$/!d; s!^'$sitedir'!!; '$dirclean \ - | sort -u | awk -F/ ' + | { + sed $dirfilter'/\/[^_.\/][^\/]*(\.(md|txt|html)|\/)$/!d; s!^'$sitedir'!!; '$dirclean + if(! ~ $#synth_paths 0) echo $synth_paths | tr ' ' $NEW_LINE + } | sort -u | awk -F/ ' function p(x, y, s) { for(i=0; i < x-y; i+=1) print s } BEGIN { lNF=2; print "<ul>" } {