Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: remove LeanInk #198

Merged
merged 1 commit into from
Jun 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading