shithub: werc

Download patch

ref: 45d30ac6a9e6d520206151ffc1f29fec9290a461
parent: add7d8d0bdf124a07da832eb718b72309f1b27fb
author: sl <[email protected]>
date: Tue Mar 3 17:34:26 EST 2009

Correct <ul> and <li> nesting in navigation sidebar.

--- a/bin/corehandlers.rc
+++ b/bin/corehandlers.rc
@@ -9,6 +9,7 @@
         | 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, "/$"))
@@ -15,8 +16,8 @@
             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 @@
         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 {