swerc

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

commit 35da6c76a11c55b36aa4809117d531f7eb734f8b
parent 45b6298d45804b12410f738594cf56179dacceb1
Author: uriel@soma <unknown>
Date:   Tue,  3 Mar 2009 22:34:26 +0000

Correct <ul> and <li> nesting in navigation sidebar.
Diffstat:
Mbin/corehandlers.rc | 7++++---
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/bin/corehandlers.rc b/bin/corehandlers.rc @@ -9,14 +9,15 @@ fn nav_tree { | sed $dirfilter'/\/[^_.\/][^\/]*(\.(md|txt|html)|\/)$/!d; s!^'$sitedir'!!; '$dirclean \ | sort -u | awk -F/ ' function p(x, y, s) { for(i=0; i < x-y; i+=1) print s } + BEGIN { lNF=2; print "<ul>" } { d = "" if(match($0, "/$")) d = "/" sub("/$", "") # Strip trailing / for dirs so NF is consistent - p(NF, lNF, "<ul>") - p(lNF, NF, "</ul>") + p(NF, lNF, "<li><ul>") + p(lNF, NF, "</ul></li>") lNF = NF bname = $NF d @@ -28,7 +29,7 @@ fn nav_tree { else print "<li><a href=\"" path "\">&rsaquo; " bname "</a></li>" } - END { p(lNF, 0, "</ul>") }' + END { p(lNF, 2, "</ul></li>"); print "</ul>" }' } fn link_bar {