diff --git a/DocGen4/Output.lean b/DocGen4/Output.lean index ce81d2f..b64b550 100644 --- a/DocGen4/Output.lean +++ b/DocGen4/Output.lean @@ -25,7 +25,7 @@ def htmlOutput (result : AnalyzerResult) : IO Unit := do FS.writeFile (basePath / "style.css") styleCss FS.writeFile (basePath / "404.html") notFoundHtml.toString FS.writeFile (basePath / "nav.js") navJs - for (module, content) in result.modules.toArray do + for (module, content) in result.moduleInfo.toArray do let moduleHtml := ReaderT.run (moduleToHtml content) config let path := moduleNameToFile basePath module FS.createDirAll $ moduleNameToDirectory basePath module diff --git a/DocGen4/Output/Base.lean b/DocGen4/Output/Base.lean index cb1d7b0..92deae9 100644 --- a/DocGen4/Output/Base.lean +++ b/DocGen4/Output/Base.lean @@ -30,10 +30,9 @@ def templateExtends {α β : Type} (base : α → HtmlM β) (new : HtmlM α) : H new >>= base -- TODO: Change this to HtmlM and auto add the root URl -def moduleNameToUrl (n : Name) : String := - (parts.intersperse "/").foldl (· ++ ·) "" ++ ".html" - where - parts := n.components.map Name.toString +def moduleNameToLink (n : Name) : HtmlM String := do + let parts := n.components.map Name.toString + (←getRoot) ++ (parts.intersperse "/").foldl (· ++ ·) "" ++ ".html" def moduleNameToFile (basePath : FilePath) (n : Name) : FilePath := FilePath.withExtension (basePath / parts.foldl (· / ·) (FilePath.mk ".")) "html" diff --git a/DocGen4/Output/Module.lean b/DocGen4/Output/Module.lean index 4a9b8aa..8bca416 100644 --- a/DocGen4/Output/Module.lean +++ b/DocGen4/Output/Module.lean @@ -15,13 +15,23 @@ namespace Output open scoped DocGen4.Jsx open Lean PrettyPrinter +def declNameToLink (name : Name) : HtmlM String := do + let res ← getResult + let module := res.moduleNames[res.name2ModIdx.find! name] + (←moduleNameToLink module) ++ "#" ++ name.toString + 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} - -- TODO: HTMLify the name etc. - nodes := nodes.push doc.getName.toString + nodes := nodes.push + + + -- TODO: HTMLify the name + {doc.getName.toString} + + -- TODO: Figure out how we can get explicit, implicit and TC args and put them here nodes := nodes.push : nodes := nodes.push