Keep alphabetical ordering and color PDF files.
parent
62d0cf38b2
commit
143b23cbab
|
@ -15,7 +15,7 @@ open scoped DocGen4.Jsx
|
||||||
|
|
||||||
def moduleListFile (file : NameExt) : BaseHtmlM Html := do
|
def moduleListFile (file : NameExt) : BaseHtmlM Html := do
|
||||||
return <div class={if (← getCurrentName) == file.name then "nav_link visible" else "nav_link"}>
|
return <div class={if (← getCurrentName) == file.name then "nav_link visible" else "nav_link"}>
|
||||||
<a href={← moduleNameExtToLink file}>{file.getString!}</a>
|
<a class={if file.ext == .pdf then "pdf_link" else ""} href={← moduleNameExtToLink file}>{file.getString!}</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
/--
|
/--
|
||||||
|
@ -23,11 +23,14 @@ Build the HTML tree representing the module hierarchy.
|
||||||
-/
|
-/
|
||||||
partial def moduleListDir (h : Hierarchy) : BaseHtmlM Html := do
|
partial def moduleListDir (h : Hierarchy) : BaseHtmlM Html := do
|
||||||
let children := Array.mk (h.getChildren.toList.map Prod.snd)
|
let children := Array.mk (h.getChildren.toList.map Prod.snd)
|
||||||
let dirs := children.filter (fun c => c.getChildren.toList.length != 0)
|
let nodes ← children.mapM (fun c =>
|
||||||
let files := children.filter (fun c => Hierarchy.isFile c && c.getChildren.toList.length = 0)
|
if c.getChildren.toList.length != 0 then
|
||||||
|>.map Hierarchy.getNameExt
|
moduleListDir c
|
||||||
let dirNodes ← dirs.mapM moduleListDir
|
else if Hierarchy.isFile c && c.getChildren.toList.length = 0 then
|
||||||
let fileNodes ← files.mapM moduleListFile
|
moduleListFile (Hierarchy.getNameExt c)
|
||||||
|
else
|
||||||
|
pure ""
|
||||||
|
)
|
||||||
let moduleLink ← moduleNameToHtmlLink h.getName
|
let moduleLink ← moduleNameToHtmlLink h.getName
|
||||||
let summary :=
|
let summary :=
|
||||||
if h.isFile then
|
if h.isFile then
|
||||||
|
@ -38,8 +41,7 @@ partial def moduleListDir (h : Hierarchy) : BaseHtmlM Html := do
|
||||||
pure
|
pure
|
||||||
<details class="nav_sect" "data-path"={moduleLink} [if (← getCurrentName).any (h.getName.isPrefixOf ·) then #[("open", "")] else #[]]>
|
<details class="nav_sect" "data-path"={moduleLink} [if (← getCurrentName).any (h.getName.isPrefixOf ·) then #[("open", "")] else #[]]>
|
||||||
{summary}
|
{summary}
|
||||||
[dirNodes]
|
[nodes]
|
||||||
[fileNodes]
|
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
/--
|
/--
|
||||||
|
|
|
@ -18,6 +18,12 @@ def cmp : Extension → Extension → Ordering
|
||||||
| pdf, pdf => Ordering.eq
|
| pdf, pdf => Ordering.eq
|
||||||
| pdf, _ => Ordering.gt
|
| pdf, _ => Ordering.gt
|
||||||
|
|
||||||
|
instance : BEq Extension where
|
||||||
|
beq e1 e2 :=
|
||||||
|
match cmp e1 e2 with
|
||||||
|
| Ordering.eq => true
|
||||||
|
| _ => false
|
||||||
|
|
||||||
def toString : Extension → String
|
def toString : Extension → String
|
||||||
| html => "html"
|
| html => "html"
|
||||||
| pdf => "pdf"
|
| pdf => "pdf"
|
||||||
|
|
|
@ -14,6 +14,10 @@ a {
|
||||||
color: var(--link-color);
|
color: var(--link-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
a.pdf_link {
|
||||||
|
color: purple;
|
||||||
|
}
|
||||||
|
|
||||||
h1, h2, h3, h4, h5, h6 {
|
h1, h2, h3, h4, h5, h6 {
|
||||||
font-family: 'Merriweather', serif;
|
font-family: 'Merriweather', serif;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue