/- Copyright (c) 2021 Henrik Böving. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Henrik Böving -/ import DocGen4.Output.Template import DocGen4.Output.Inductive namespace DocGen4 namespace Output open scoped DocGen4.Jsx open Lean def argToHtml (arg : Arg) : HtmlM Html := do let (l, r, implicit) := match arg.binderInfo with | BinderInfo.default => ("(", ")", false) | BinderInfo.implicit => ("{", "}", true) | BinderInfo.strictImplicit => ("⦃", "⦄", true) | BinderInfo.instImplicit => ("[", "]", true) -- TODO: Can this ever be reached here? What does it mean? | BinderInfo.auxDecl => unreachable! let mut nodes := #[Html.text s!"{l}{arg.name.toString} : "] nodes := nodes.append (←infoFormatToHtml arg.type) nodes := nodes.push r let inner := Html.element "span" true #[("class", "fn")] nodes let html := Html.element "span" false #[("class", "decl_args")] #[inner] if implicit then {html} else html def docInfoHeader (doc : DocInfo) : HtmlM Html := do let mut nodes := #[] -- TODO: noncomputable, partial -- TODO: Support all the kinds in CSS nodes := nodes.push {doc.getKind} nodes := nodes.push -- TODO: HTMLify the name {doc.getName.toString} for arg in doc.getArgs do nodes := nodes.push (←argToHtml arg) nodes := nodes.push : nodes := nodes.push $ Html.element "div" true #[("class", "decl_type")] (←infoFormatToHtml doc.getType) -- TODO: The final type of the declaration return