feat: List of declarations in internal navbar
parent
82f63cb613
commit
2de568d5ca
|
@ -89,14 +89,27 @@ def docInfoToHtml (doc : DocInfo) : HtmlM Html := do
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
def moduleToNavLink (module : Name) : Html :=
|
||||||
|
<div «class»="nav_link">
|
||||||
|
<a «class»="break_within" href={s!"#{module.toString}"}>{module.toString}</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
def internalNav (members : Array Name) (moduleName : Name) : Html :=
|
||||||
|
<nav «class»="internal_nav">
|
||||||
|
<h3><a «class»="break_within" href="#top">{moduleName.toString}</a></h3>
|
||||||
|
-- TODO: Proper source links
|
||||||
|
<p «class»="gh_nav_link"><a href="https://github.com">source</a></p>
|
||||||
|
[members.map moduleToNavLink]
|
||||||
|
</nav>
|
||||||
|
|
||||||
def moduleToHtml (module : Module) : HtmlM Html := withReader (setCurrentName module.name) do
|
def moduleToHtml (module : Module) : HtmlM Html := withReader (setCurrentName module.name) do
|
||||||
-- TODO: Probably some sort of ordering by line number would be cool?
|
|
||||||
-- maybe they should already be ordered in members.
|
|
||||||
let sortedMembers := module.members.qsort (λ l r => l.getDeclarationRange.pos.line < r.getDeclarationRange.pos.line)
|
let sortedMembers := module.members.qsort (λ l r => l.getDeclarationRange.pos.line < r.getDeclarationRange.pos.line)
|
||||||
let docInfos ← sortedMembers.mapM docInfoToHtml
|
let docInfos ← sortedMembers.mapM docInfoToHtml
|
||||||
-- TODO: This is missing imports, imported by, source link, list of decls
|
-- TODO: This is missing imports, imported by
|
||||||
templateExtends (baseHtml module.name.toString) $
|
templateExtends (baseHtmlArray module.name.toString) $ #[
|
||||||
|
internalNav (sortedMembers.map DocInfo.getName) module.name,
|
||||||
Html.element "main" false #[] docInfos
|
Html.element "main" false #[] docInfos
|
||||||
|
]
|
||||||
|
|
||||||
end Output
|
end Output
|
||||||
end DocGen4
|
end DocGen4
|
||||||
|
|
|
@ -11,7 +11,7 @@ namespace Output
|
||||||
|
|
||||||
open scoped DocGen4.Jsx
|
open scoped DocGen4.Jsx
|
||||||
|
|
||||||
def baseHtml (title : String) (site : Html) : HtmlM Html := do
|
def baseHtmlArray (title : String) (site : Array Html) : HtmlM Html := do
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<link rel="stylesheet" href={s!"{←getRoot}style.css"}/>
|
<link rel="stylesheet" href={s!"{←getRoot}style.css"}/>
|
||||||
|
@ -37,9 +37,7 @@ def baseHtml (title : String) (site : Html) : HtmlM Html := do
|
||||||
</form>
|
</form>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<nav «class»="internal_nav"></nav>
|
[site]
|
||||||
|
|
||||||
{site}
|
|
||||||
|
|
||||||
{←navbar}
|
{←navbar}
|
||||||
|
|
||||||
|
@ -53,5 +51,8 @@ def baseHtml (title : String) (site : Html) : HtmlM Html := do
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
||||||
|
|
||||||
|
def baseHtml (title : String) (site : Html) : HtmlM Html := baseHtmlArray title #[site]
|
||||||
|
|
||||||
end Output
|
end Output
|
||||||
end DocGen4
|
end DocGen4
|
||||||
|
|
Loading…
Reference in New Issue