/- Copyright (c) 2022 Henrik Böving. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Henrik Böving, Xubai Wang -/ import DocGen4.Output.Base import DocGen4.Output.ToHtmlFormat import DocGen4.LeanInk.Process import Lean.Data.Json import LeanInk.Annotation.Alectryon namespace LeanInk.Annotation.Alectryon open DocGen4 Output open scoped DocGen4.Jsx structure AlectryonContext where counter : Nat abbrev AlectryonM := StateT AlectryonContext HtmlM def getNextButtonLabel : AlectryonM String := do let val ← get let newCounter := val.counter + 1 set { val with counter := newCounter } pure s!"plain-lean4-lean-chk{val.counter}" def TypeInfo.toHtml : TypeInfo → AlectryonM Html := sorry def Token.toHtml (t : Token) : AlectryonM Html := do -- TODO: Show rest of token pure $ Html.text t.raw def Contents.toHtml : Contents → AlectryonM (Array Html) | .string value => pure #[Html.text value] | .experimentalTokens values => values.mapM Token.toHtml def Hypothesis.toHtml (h : Hypothesis) : AlectryonM Html := do let mut hypParts := #[[h.names.intersperse ", " |>.map Html.text |>.toArray]] if h.body != "" then hypParts := hypParts.push := {h.body} hypParts := hypParts.push : {h.type} pure [hypParts] def Goal.toHtml (g : Goal) : AlectryonM Html := do let mut hypotheses := #[] for hyp in g.hypotheses do let rendered ← hyp.toHtml hypotheses := hypotheses.push rendered hypotheses := hypotheses.push
pure
[hypotheses]
{g.name}
{g.conclusion} def Message.toHtml (m : Message) : AlectryonM Html := do pure
-- TODO: This might have to be done in a fancier way {m.contents} def Sentence.toHtml (s : Sentence) : AlectryonM Html := do let messages := if s.messages.size > 0 then #[
[←s.messages.mapM Message.toHtml] ] else #[] let goals := if s.goals.size > 0 then -- TODO: Alectryon has a "alectryon-extra-goals" here, implement it #[