Skip to content

Commit

Permalink
chore: remove leanink
Browse files Browse the repository at this point in the history
  • Loading branch information
hargoniX committed Jun 18, 2024
1 parent c5f9e71 commit 1f51169
Show file tree
Hide file tree
Showing 14 changed files with 7 additions and 1,988 deletions.
1 change: 0 additions & 1 deletion DocGen4.lean
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,3 @@ Authors: Henrik Böving
import DocGen4.Process
import DocGen4.Load
import DocGen4.Output
import DocGen4.LeanInk
7 changes: 0 additions & 7 deletions DocGen4/LeanInk.lean

This file was deleted.

216 changes: 0 additions & 216 deletions DocGen4/LeanInk/Output.lean

This file was deleted.

57 changes: 0 additions & 57 deletions DocGen4/LeanInk/Process.lean

This file was deleted.

27 changes: 3 additions & 24 deletions DocGen4/Output.lean
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import DocGen4.Output.SourceLinker
import DocGen4.Output.Search
import DocGen4.Output.ToJson
import DocGen4.Output.FoundationalTypes
import DocGen4.LeanInk.Process
import Lean.Data.HashMap

namespace DocGen4
Expand Down Expand Up @@ -66,34 +65,20 @@ def htmlOutputSetup (config : SiteBaseContext) : IO Unit := do
for (fileName, content) in findStatic do
FS.writeFile (findBasePath / fileName) content

let alectryonStatic := #[
("alectryon.css", alectryonCss),
("alectryon.js", alectryonJs),
("docutils_basic.css", docUtilsCss),
("pygments.css", pygmentsCss)
]

for (fileName, content) in alectryonStatic do
FS.writeFile (srcBasePath / fileName) content

def htmlOutputDeclarationDatas (result : AnalyzerResult) : HtmlT IO Unit := do
for (_, mod) in result.moduleInfo.toArray do
let jsonDecls ← Module.toJson mod
FS.writeFile (declarationsBasePath / s!"declaration-data-{mod.name}.bmp") (toJson jsonDecls).compress

def htmlOutputResults (baseConfig : SiteBaseContext) (result : AnalyzerResult) (sourceUrl? : Option String) (ink : Bool) : IO Unit := do
def htmlOutputResults (baseConfig : SiteBaseContext) (result : AnalyzerResult) (sourceUrl? : Option String) : IO Unit := do
let config : SiteContext := {
result := result,
sourceLinker := SourceLinker.sourceLinker sourceUrl?
leanInkEnabled := ink
}

FS.createDirAll basePath
FS.createDirAll declarationsBasePath

let some p := (← IO.getEnv "LEAN_SRC_PATH") | throw <| IO.userError "LEAN_SRC_PATH not found in env"
let sourceSearchPath := System.SearchPath.parse p

discard <| htmlOutputDeclarationDatas result |>.run config baseConfig

for (modName, module) in result.moduleInfo.toArray do
Expand All @@ -108,12 +93,6 @@ def htmlOutputResults (baseConfig : SiteBaseContext) (result : AnalyzerResult) (
let moduleHtml := moduleToHtml module |>.run config baseConfig
FS.createDirAll fileDir
FS.writeFile filePath moduleHtml.toString
if ink then
if let some inputPath ← Lean.SearchPath.findModuleWithExt sourceSearchPath "lean" module.name then
-- path: 'basePath/src/module/components/till/last.html'
-- The last component is the file name, however we are in src/ here so dont drop it this time
let baseConfig := {baseConfig with depthToRoot := modName.components.length }
Process.LeanInk.runInk inputPath |>.run config baseConfig

def getSimpleBaseContext (hierarchy : Hierarchy) : IO SiteBaseContext := do
return {
Expand Down Expand Up @@ -145,9 +124,9 @@ def htmlOutputIndex (baseConfig : SiteBaseContext) : IO Unit := do
The main entrypoint for outputting the documentation HTML based on an
`AnalyzerResult`.
-/
def htmlOutput (result : AnalyzerResult) (hierarchy : Hierarchy) (sourceUrl? : Option String) (ink : Bool) : IO Unit := do
def htmlOutput (result : AnalyzerResult) (hierarchy : Hierarchy) (sourceUrl? : Option String) : IO Unit := do
let baseConfig ← getSimpleBaseContext hierarchy
htmlOutputResults baseConfig result sourceUrl? ink
htmlOutputResults baseConfig result sourceUrl?
htmlOutputIndex baseConfig

end DocGen4
Loading

0 comments on commit 1f51169

Please sign in to comment.