swerc

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

commit 398b43f6d378c6c2466b3a269f44273eb96ad339
parent 6f4fca0d1142f8b0eead9f65d3c7757ee7988af1
Author: uriel@engel.se.cat-v.org <unknown>
Date:   Sat, 17 Jan 2009 03:05:19 +0100

Make left sidebar into a list of handlers.
Diffstat:
Mbin/werc.rc | 6++++--
Mlib/default_master.tpl | 34+++++++++-------------------------
2 files changed, 13 insertions(+), 27 deletions(-)

diff --git a/bin/werc.rc b/bin/werc.rc @@ -26,7 +26,9 @@ fn hide_paths { } # Sidebar -fn gensidebar { +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 \ @@ -135,7 +137,7 @@ path=(. $PLAN9/bin ./bin/ /bin/ /usr/bin) headers=lib/headers.tpl master_template=default_master.tpl res_tail='</body></html>' -sidebar=sidebar +ll_add handlers_bar_left nav_tree werc_root=`{pwd} for(i in siteTitle siteSubTitle pageTitle extraHeaders) $i = '' diff --git a/lib/default_master.tpl b/lib/default_master.tpl @@ -13,33 +13,17 @@ </div> </div> -% if(! ~ $#sidebar 0) { -<div id="side-bar"> - -<div> %{ -if(! ~ $#sideBarNavTitle 0) - echo '<p class="sideBarTitle">'$"sideBarNavTitle':</p>' - -gensidebar - +if(! ~ $#handlers_bar_left 0) { + echo '<div id="side-bar">' + for(h in $handlers_bar_left) { + echo '<div>' + run_handler $$h + echo '</div>' + } + echo '<div><!-- Bottom filler div --></div> </div>' +} %} -</div> - -% if(! ~ $#wiki 0 && test -f $local_path.md && check_user $wiki_editors_group) { -<div> - <form action="/_apps/dirdir/edit" method="POST"> - <input type="hidden" name="edit_wiki_page" value="%($req_path%)" /> - <input type="submit" name="" value="Edit page" /> - </form> -</div> -% } - -<div> -</div> - -</div> -% } <div id="main-copy">