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-05-19 22:36:43 +00:00
|
|
|
import DocGen4.Process
|
2022-01-03 17:22:12 +00:00
|
|
|
|
|
|
|
namespace DocGen4
|
|
|
|
namespace Output
|
|
|
|
|
|
|
|
open scoped DocGen4.Jsx
|
2022-07-23 13:40:08 +00:00
|
|
|
open Lean
|
|
|
|
|
2022-11-20 11:48:16 +00:00
|
|
|
def instancesForToHtml (typeName : Name) : BaseHtmlM Html := do
|
2022-07-23 13:40:08 +00:00
|
|
|
pure
|
|
|
|
<details «class»="instances">
|
|
|
|
<summary>Instances For</summary>
|
|
|
|
<ul id={s!"instances-for-list-{typeName}"} class="instances-for-list"></ul>
|
|
|
|
</details>
|
2022-01-03 17:22:12 +00:00
|
|
|
|
2022-07-21 18:23:27 +00:00
|
|
|
def ctorToHtml (c : Process.NameInfo) : HtmlM Html := do
|
2022-10-20 17:51:26 +00:00
|
|
|
let shortName := c.name.componentsRev.head!.toString
|
2022-07-21 18:23:27 +00:00
|
|
|
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>
|
2023-01-01 18:51:01 +00:00
|
|
|
{shortName} : [← infoFormatToHtml c.type]
|
2022-07-21 18:23:27 +00:00
|
|
|
</li>
|
|
|
|
else
|
|
|
|
pure
|
|
|
|
<li class="constructor" id={name}>
|
2023-01-01 18:51:01 +00:00
|
|
|
{shortName} : [← infoFormatToHtml c.type]
|
2022-07-21 18:23:27 +00:00
|
|
|
</li>
|
2022-01-03 17:22:12 +00:00
|
|
|
|
2022-05-19 22:36:43 +00:00
|
|
|
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>
|
2023-01-01 18:51:01 +00:00
|
|
|
return #[constructorsHtml]
|
2022-01-03 17:22:12 +00:00
|
|
|
|
|
|
|
end Output
|
|
|
|
end DocGen4
|