Correct <ul> and <li> nesting in navigation sidebar.
This commit is contained in:
parent
547f98328f
commit
feb444fc1c
1 changed files with 4 additions and 3 deletions
|
|
@ -9,14 +9,15 @@ fn nav_tree {
|
||||||
| sed $dirfilter'/\/[^_.\/][^\/]*(\.(md|txt|html)|\/)$/!d; s!^'$sitedir'!!; '$dirclean \
|
| sed $dirfilter'/\/[^_.\/][^\/]*(\.(md|txt|html)|\/)$/!d; s!^'$sitedir'!!; '$dirclean \
|
||||||
| sort -u | awk -F/ '
|
| sort -u | awk -F/ '
|
||||||
function p(x, y, s) { for(i=0; i < x-y; i+=1) print s }
|
function p(x, y, s) { for(i=0; i < x-y; i+=1) print s }
|
||||||
|
BEGIN { lNF=2; print "<ul>" }
|
||||||
{
|
{
|
||||||
d = ""
|
d = ""
|
||||||
if(match($0, "/$"))
|
if(match($0, "/$"))
|
||||||
d = "/"
|
d = "/"
|
||||||
sub("/$", "") # Strip trailing / for dirs so NF is consistent
|
sub("/$", "") # Strip trailing / for dirs so NF is consistent
|
||||||
|
|
||||||
p(NF, lNF, "<ul>")
|
p(NF, lNF, "<li><ul>")
|
||||||
p(lNF, NF, "</ul>")
|
p(lNF, NF, "</ul></li>")
|
||||||
lNF = NF
|
lNF = NF
|
||||||
|
|
||||||
bname = $NF d
|
bname = $NF d
|
||||||
|
|
@ -28,7 +29,7 @@ fn nav_tree {
|
||||||
else
|
else
|
||||||
print "<li><a href=\"" path "\">› " bname "</a></li>"
|
print "<li><a href=\"" path "\">› " bname "</a></li>"
|
||||||
}
|
}
|
||||||
END { p(lNF, 0, "</ul>") }'
|
END { p(lNF, 2, "</ul></li>"); print "</ul>" }'
|
||||||
}
|
}
|
||||||
|
|
||||||
fn link_bar {
|
fn link_bar {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue