fix: add nav link to non leaf node modules

main
Xubai Wang 2022-02-18 14:03:54 +08:00
parent 2dac93d360
commit 828449ebb4
3 changed files with 7 additions and 10 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
@ -107,7 +107,7 @@ macro_rules
let mut cs ← `(#[])
for child in children do
cs ← match child with
| `(jsxChild|$t:jsxText) => `(($cs).push (Html.text $(quote t[0].getAtomVal!)))
| `(jsxChild|$t:jsxText) => `(($cs).push (Html.text $(quote t[0].getAtomVal!))
-- TODO(WN): elab as list of children if type is `t Html` where `Foldable t`
| `(jsxChild|{$t}) => `(($cs).push ($t : Html))
| `(jsxChild|[$t]) => `($cs ++ ($t : Array Html))

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%;
}