bookshelf-doc/DocGen4/Output/Inductive.lean

32 lines
878 B
Plaintext
Raw Normal View History

import DocGen4.Output.Template
2022-02-17 05:47:38 +00:00
import DocGen4.Output.DocString
import DocGen4.Process
namespace DocGen4
namespace Output
open scoped DocGen4.Jsx
def ctorToHtml (c : Process.NameInfo) : HtmlM Html := do
let shortName := c.name.components'.head!.toString
let name := c.name.toString
if let some doc := c.doc then
let renderedDoc ← docStringToHtml doc
pure
<li class="constructor" id={name}>
<div class="inductive_ctor_doc">[renderedDoc]</div>
{shortName} : [←infoFormatToHtml c.type]
</li>
else
pure
<li class="constructor" id={name}>
{shortName} : [←infoFormatToHtml c.type]
</li>
def inductiveToHtml (i : Process.InductiveInfo) : HtmlM (Array Html) := do
2022-05-19 15:16:40 +00:00
let constructorsHtml := <ul class="constructors">[← i.ctors.toArray.mapM ctorToHtml]</ul>
2022-02-18 03:28:44 +00:00
pure #[constructorsHtml]
end Output
end DocGen4