swerc

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

commit 8cc1b6cf53766e23aea89970973b728ef54588a2
parent 64316c376d802bf5918b977dd2bf936b1f0451d0
Author: uriel@vm41.cat-v.org <unknown>
Date:   Thu,  6 Aug 2009 02:20:58 +0200

Fix bug where incorrect elements in the navigation sidebar were highlighted, thanks to arg for reporting this.
Diffstat:
Mbin/corehandlers.rc | 6+++++-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/bin/corehandlers.rc b/bin/corehandlers.rc @@ -26,7 +26,11 @@ fn nav_tree { path = $0 d gsub(/[\-_]/, " ", bname) - if(index(ENVIRON["req_path"] "/", path) == 1) + # To avoid false matches add trailing / even for plain files to act as delimiter + pa = path + gsub(/[^\/]$/, "&/", pa) + + if(index(ENVIRON["req_path"] "/", pa) == 1) print "<li><a href=\"" path "\" class=\"thisPage\">&raquo;<i> " bname "</i></a></li>" else print "<li><a href=\"" path "\">&rsaquo; " bname "</a></li>"