2022-01-03 17:22:12 +00:00
|
|
|
import DocGen4.Output.Template
|
2022-02-17 05:47:38 +00:00
|
|
|
import DocGen4.Output.DocString
|
2022-01-03 17:22:12 +00:00
|
|
|
|
|
|
|
namespace DocGen4
|
|
|
|
namespace Output
|
|
|
|
|
|
|
|
open scoped DocGen4.Jsx
|
|
|
|
|
|
|
|
def ctorToHtml (i : NameInfo) : HtmlM Html := do
|
2022-01-09 13:07:50 +00:00
|
|
|
let shortName := i.name.components'.head!.toString
|
|
|
|
let name := i.name.toString
|
2022-02-12 14:09:13 +00:00
|
|
|
pure <li «class»="constructor" id={name}>{shortName} : [←infoFormatToHtml i.type]</li>
|
2022-01-03 17:22:12 +00:00
|
|
|
|
2022-02-12 14:09:13 +00:00
|
|
|
def inductiveToHtml (i : InductiveInfo) : HtmlM (Array Html) := do
|
2022-02-15 11:27:12 +00:00
|
|
|
let constructorsHtml := <ul "class"="constructors">[← i.ctors.toArray.mapM ctorToHtml]</ul>
|
2022-02-17 05:47:38 +00:00
|
|
|
let docstringHtml? := i.doc.map docStringToHtml
|
2022-02-15 11:27:12 +00:00
|
|
|
match docstringHtml? with
|
|
|
|
| some d => pure #[constructorsHtml, d]
|
|
|
|
| none => pure #[constructorsHtml]
|
2022-01-03 17:22:12 +00:00
|
|
|
|
|
|
|
end Output
|
|
|
|
end DocGen4
|