fix: add nav link to non leaf node modules

main
Xubai Wang 2022-02-18 14:03:54 +08:00
parent 2dac93d360
commit 2f5a95b312
3 changed files with 6 additions and 9 deletions

View File

@ -28,7 +28,7 @@ partial def moduleListDir (h : Hierarchy) : HtmlM Html := do
pure
<details "class"="nav_sect" "data-path"={moduleLink}
[if (←getCurrentName).any (h.getName.isPrefixOf ·) then #[("open", "")] else #[]]>
<summary>{h.getName.toString}</summary>
<summary><a "href"={← moduleNameToLink h.getName}>{h.getName.toString}</a></summary>
[dirNodes]
[fileNodes]
</details>

View File

@ -33,9 +33,9 @@ def attributesToString (attrs : Array (String × String)) :String :=
-- TODO: Termination proof
partial def toStringAux : Html → String
| element tag false attrs #[text s] => s!"<{tag}{attributesToString attrs}>{s}</{tag}>\n"
| element tag false attrs #[child] => s!"<{tag}{attributesToString attrs}>\n{child.toStringAux}</{tag}>\n"
| element tag false attrs children => s!"<{tag}{attributesToString attrs}>\n{children.foldl (· ++ toStringAux ·) ""}</{tag}>\n"
| element tag false attrs #[text s] => s!"<{tag}{attributesToString attrs}>{s}</{tag}>"
| element tag false attrs #[child] => s!"<{tag}{attributesToString attrs}>{child.toStringAux}</{tag}>"
| element tag false attrs children => s!"<{tag}{attributesToString attrs}>{children.foldl (· ++ toStringAux ·) ""}</{tag}>"
| element tag true attrs children => s!"<{tag}{attributesToString attrs}>{children.foldl (· ++ toStringAux ·) ""}</{tag}>"
| text s => s

View File

@ -273,13 +273,10 @@ nav {
margin-top: 1ex;
}
.nav details > * {
.nav details, .nav_link {
padding-left: 2ex;
}
.nav summary {
cursor: pointer;
padding-left: 0;
}
.nav summary::marker {
font-size: 85%;
}