style: Lean 4 compiler style in LeanInk
parent
f74443a673
commit
d5ef8006b7
|
@ -23,7 +23,7 @@ def getNextButtonLabel : AlectryonM String := do
|
||||||
let val ← get
|
let val ← get
|
||||||
let newCounter := val.counter + 1
|
let newCounter := val.counter + 1
|
||||||
set { val with counter := newCounter }
|
set { val with counter := newCounter }
|
||||||
pure s!"plain-lean4-lean-chk{val.counter}"
|
return s!"plain-lean4-lean-chk{val.counter}"
|
||||||
|
|
||||||
def TypeInfo.toHtml (tyi : TypeInfo) : AlectryonM Html := do
|
def TypeInfo.toHtml (tyi : TypeInfo) : AlectryonM Html := do
|
||||||
pure
|
pure
|
||||||
|
@ -106,7 +106,7 @@ def Goal.toHtml (g : Goal) : AlectryonM Html := do
|
||||||
let conclusionHtml ←
|
let conclusionHtml ←
|
||||||
match g.conclusion with
|
match g.conclusion with
|
||||||
| .typed info _ => infoFormatToHtml info
|
| .typed info _ => infoFormatToHtml info
|
||||||
| .untyped str => pure <| #[Html.text str]
|
| .untyped str => pure #[Html.text str]
|
||||||
|
|
||||||
pure
|
pure
|
||||||
<blockquote class="alectryon-goal">
|
<blockquote class="alectryon-goal">
|
||||||
|
@ -210,6 +210,6 @@ def annotationsToFragments (as : List Annotation.Annotation) : AnalysisM (List F
|
||||||
def renderAnnotations (as : List Annotation.Annotation) : HtmlT AnalysisM Html := do
|
def renderAnnotations (as : List Annotation.Annotation) : HtmlT AnalysisM Html := do
|
||||||
let fs ← annotationsToFragments as
|
let fs ← annotationsToFragments as
|
||||||
let (html, _) ← fs.mapM Fragment.toHtml >>= (baseHtml ∘ List.toArray) |>.run { counter := 0 }
|
let (html, _) ← fs.mapM Fragment.toHtml >>= (baseHtml ∘ List.toArray) |>.run { counter := 0 }
|
||||||
pure html
|
return html
|
||||||
|
|
||||||
end LeanInk.Annotation.Alectryon
|
end LeanInk.Annotation.Alectryon
|
||||||
|
|
|
@ -21,7 +21,7 @@ def docGenOutput (as : List LeanInk.Annotation.Annotation) : HtmlT LeanInk.Analy
|
||||||
let srcPath := moduleNameToFile srcBasePath modName
|
let srcPath := moduleNameToFile srcBasePath modName
|
||||||
IO.FS.createDirAll srcDir
|
IO.FS.createDirAll srcDir
|
||||||
IO.FS.writeFile srcPath srcHtml.toString
|
IO.FS.writeFile srcPath srcHtml.toString
|
||||||
pure 0
|
return 0
|
||||||
|
|
||||||
def execAuxM : HtmlT LeanInk.AnalysisM UInt32 := do
|
def execAuxM : HtmlT LeanInk.AnalysisM UInt32 := do
|
||||||
let ctx ← readThe SiteContext
|
let ctx ← readThe SiteContext
|
||||||
|
@ -36,7 +36,7 @@ def execAux (config : LeanInk.Configuration) : HtmlT IO UInt32 := do
|
||||||
execAuxM.run (← readThe SiteContext) (← readThe SiteBaseContext) |>.run config
|
execAuxM.run (← readThe SiteContext) (← readThe SiteBaseContext) |>.run config
|
||||||
|
|
||||||
@[implemented_by enableInitializersExecution]
|
@[implemented_by enableInitializersExecution]
|
||||||
private def enableInitializersExecutionWrapper : IO Unit := pure ()
|
private def enableInitializersExecutionWrapper : IO Unit := return ()
|
||||||
|
|
||||||
def runInk (sourceFilePath : System.FilePath) : HtmlT IO Unit := do
|
def runInk (sourceFilePath : System.FilePath) : HtmlT IO Unit := do
|
||||||
let contents ← IO.FS.readFile sourceFilePath
|
let contents ← IO.FS.readFile sourceFilePath
|
||||||
|
|
Loading…
Reference in New Issue