diff --git a/DocGen4/Load.lean b/DocGen4/Load.lean index fc2ef09..619ea7f 100644 --- a/DocGen4/Load.lean +++ b/DocGen4/Load.lean @@ -56,6 +56,6 @@ def load (task : Process.AnalyzeTask) : IO (Process.AnalyzerResult × Hierarchy) Prod.fst <$> Meta.MetaM.toIO (Process.process task) config { env := env } {} {} def loadCore : IO (Process.AnalyzerResult × Hierarchy) := do - load <| .loadAll [`Init, `Lean] + load <| .loadAll [`Init, `Lean, `Lake] end DocGen4 diff --git a/DocGen4/Output/Inductive.lean b/DocGen4/Output/Inductive.lean index 0afeaf6..fde7d40 100644 --- a/DocGen4/Output/Inductive.lean +++ b/DocGen4/Output/Inductive.lean @@ -22,8 +22,8 @@ def ctorToHtml (c : Process.NameInfo) : HtmlM Html := do let renderedDoc ← docStringToHtml doc pure
  • -
    [renderedDoc]
    {shortName} : [← infoFormatToHtml c.type] +
    [renderedDoc]
  • else pure diff --git a/DocGen4/Output/SourceLinker.lean b/DocGen4/Output/SourceLinker.lean index a8ef27d..48ca406 100644 --- a/DocGen4/Output/SourceLinker.lean +++ b/DocGen4/Output/SourceLinker.lean @@ -74,8 +74,8 @@ def sourceLinker (ws : Lake.Workspace) : IO (Name → Option DeclarationRange |>.toIO (fun _ => IO.userError "Failed to load lake manifest") for pkg in manifest.entryArray do match pkg with - | .git _ url rev .. => gitMap := gitMap.insert pkg.name (getGithubBaseUrl url, rev) - | .path _ path => + | .git _ _ _ url rev .. => gitMap := gitMap.insert pkg.name (getGithubBaseUrl url, rev) + | .path _ _ _ path => let pkgBaseUrl := getGithubBaseUrl (← getProjectGithubUrl path) let pkgCommit ← getProjectCommit path gitMap := gitMap.insert pkg.name (pkgBaseUrl, pkgCommit) @@ -86,6 +86,8 @@ def sourceLinker (ws : Lake.Workspace) : IO (Name → Option DeclarationRange let root := module.getRoot let basic := if root == `Lean ∨ root == `Init then s!"https://github.com/leanprover/lean4/blob/{leanHash}/src/{path}.lean" + else if root == `Lake then + s!"https://github.com/leanprover/lean4/blob/{leanHash}/src/lake/{path}.lean" else match ws.packageArray.find? (·.isLocalModule module) with | some pkg => diff --git a/DocGen4/Output/Structure.lean b/DocGen4/Output/Structure.lean index f4ab138..8f48dc3 100644 --- a/DocGen4/Output/Structure.lean +++ b/DocGen4/Output/Structure.lean @@ -18,8 +18,8 @@ def fieldToHtml (f : Process.NameInfo) : HtmlM Html := do let renderedDoc ← docStringToHtml doc pure
  • -
    [renderedDoc]
    {s!"{shortName} "} : [← infoFormatToHtml f.type]
    +
    [renderedDoc]
  • else pure diff --git a/DocGen4/Process/Attributes.lean b/DocGen4/Process/Attributes.lean index 4eccced..14d3336 100644 --- a/DocGen4/Process/Attributes.lean +++ b/DocGen4/Process/Attributes.lean @@ -62,34 +62,42 @@ open Compiler in instance : ToString InlineAttributeKind where toString kind := match kind with - | InlineAttributeKind.inline => "inline" - | InlineAttributeKind.noinline => "noinline" - | InlineAttributeKind.macroInline => "macro_inline" - | InlineAttributeKind.inlineIfReduce => "inline_if_reduce" - | InlineAttributeKind.alwaysInline => "always_inline" + | .inline => "inline" + | .noinline => "noinline" + | .macroInline => "macro_inline" + | .inlineIfReduce => "inline_if_reduce" + | .alwaysInline => "always_inline" open Compiler in instance : ToString SpecializeAttributeKind where toString kind := match kind with - | SpecializeAttributeKind.specialize => "specialize" - | SpecializeAttributeKind.nospecialize => "nospecialize" + | .specialize => "specialize" + | .nospecialize => "nospecialize" + +instance : ToString ReducibilityStatus where + toString kind := + match kind with + | .reducible => "reducible" + | .semireducible => "semireducible" + | .irreducible => "irreducible" /-- The list of all enum based attributes doc-gen knows about and can recover. -/ -def enumAttributes : Array EnumAttrWrapper := #[⟨Compiler.inlineAttrs⟩] +@[reducible] +def enumAttributes : Array EnumAttrWrapper := #[⟨Compiler.inlineAttrs⟩, ⟨reducibilityAttrs⟩] instance : ToString ExternEntry where toString entry := match entry with - | ExternEntry.adhoc `all => "" - | ExternEntry.adhoc backend => s!"{backend} adhoc" - | ExternEntry.standard `all fn => fn - | ExternEntry.standard backend fn => s!"{backend} {fn}" - | ExternEntry.inline backend pattern => s!"{backend} inline {String.quote pattern}" + | .adhoc `all => "" + | .adhoc backend => s!"{backend} adhoc" + | .standard `all fn => fn + | .standard backend fn => s!"{backend} {fn}" + | .inline backend pattern => s!"{backend} inline {String.quote pattern}" -- TODO: The docs in the module dont specific how to render this - | ExternEntry.foreign backend fn => s!"{backend} foreign {fn}" + | .foreign backend fn => s!"{backend} foreign {fn}" instance : ToString ExternAttrData where toString data := (data.arity?.map toString |>.getD "") ++ " " ++ String.intercalate " " (data.entries.map toString) diff --git a/DocGen4/Process/DocInfo.lean b/DocGen4/Process/DocInfo.lean index 8985ab8..e736c16 100644 --- a/DocGen4/Process/DocInfo.lean +++ b/DocGen4/Process/DocInfo.lean @@ -190,17 +190,19 @@ def getKindDescription : DocInfo → String | DefinitionSafety.unsafe => "unsafe opaque" | DefinitionSafety.partial => "partial def" | definitionInfo i => Id.run do - if i.hints.isAbbrev then - return "abbrev" - else - let mut modifiers := #[] - if i.isUnsafe then - modifiers := modifiers.push "unsafe" - if i.isNonComputable then - modifiers := modifiers.push "noncomputable" + let mut modifiers := #[] + if i.isUnsafe then + modifiers := modifiers.push "unsafe" + if i.isNonComputable then + modifiers := modifiers.push "noncomputable" - modifiers := modifiers.push "def" - return String.intercalate " " modifiers.toList + let defKind := + if i.hints.isAbbrev then + "abbrev" + else + "def" + modifiers := modifiers.push defKind + return String.intercalate " " modifiers.toList | instanceInfo i => Id.run do let mut modifiers := #[] if i.isUnsafe then diff --git a/lake-manifest.json b/lake-manifest.json index 7b844fb..cc3dc29 100644 --- a/lake-manifest.json +++ b/lake-manifest.json @@ -1,63 +1,83 @@ -{"version": 4, +{"version": 5, "packagesDir": "lake-packages", "packages": [{"git": {"url": "https://github.com/xubaiw/CMark.lean", "subDir?": null, "rev": "0077cbbaa92abf855fc1c0413e158ffd8195ec77", + "opts": {}, "name": "CMark", - "inputRev?": "main"}}, + "inputRev?": "main", + "inherited": false}}, {"git": {"url": "https://github.com/EdAyers/ProofWidgets4", "subDir?": null, "rev": "a0c2cd0ac3245a0dade4f925bcfa97e06dd84229", + "opts": {}, "name": "proofwidgets", - "inputRev?": "v0.0.13"}}, + "inputRev?": "v0.0.13", + "inherited": true}}, {"git": {"url": "https://github.com/leanprover/lake", "subDir?": null, "rev": "a2ced44b7e5e30c2a6b84b420e1bbdd8d6d8e079", + "opts": {}, "name": "lake", - "inputRev?": "master"}}, + "inputRev?": "master", + "inherited": false}}, {"git": {"url": "https://github.com/fgdorais/lean4-unicode-basic", "subDir?": null, - "rev": "f09250282cea3ed8c010f430264d9e8e50d7bc32", - "name": "lean4-unicode-basic", - "inputRev?": "main"}}, + "rev": "2491e781ae478b6e6f1d86a7157f1c58fc50f895", + "opts": {}, + "name": "«lean4-unicode-basic»", + "inputRev?": "main", + "inherited": false}}, {"git": {"url": "https://github.com/mhuisi/lean4-cli", "subDir?": null, - "rev": "5a858c32963b6b19be0d477a30a1f4b6c120be7e", + "rev": "21dac2e9cc7e3cf7da5800814787b833e680b2fd", + "opts": {}, "name": "Cli", - "inputRev?": "nightly"}}, + "inputRev?": "nightly", + "inherited": false}}, {"git": {"url": "https://github.com/leanprover-community/mathlib4.git", "subDir?": null, - "rev": "280a9f50ed49fc27396d06d438fde63691818268", + "rev": "d04897a61efc29f2393f448154f212472c91b47d", + "opts": {}, "name": "mathlib", - "inputRev?": "master"}}, + "inputRev?": "master", + "inherited": false}}, {"git": {"url": "https://github.com/gebner/quote4", "subDir?": null, - "rev": "81cc13c524a68d0072561dbac276cd61b65872a6", + "rev": "e75daed95ad1c92af4e577fea95e234d7a8401c1", + "opts": {}, "name": "Qq", - "inputRev?": "master"}}, + "inputRev?": "master", + "inherited": true}}, {"git": {"url": "https://github.com/JLimperg/aesop", "subDir?": null, - "rev": "d13a9666e6f430b940ef8d092f1219e964b52a09", + "rev": "1a0cded2be292b5496e659b730d2accc742de098", + "opts": {}, "name": "aesop", - "inputRev?": "master"}}, + "inputRev?": "master", + "inherited": true}}, {"git": {"url": "https://github.com/hargonix/LeanInk", "subDir?": null, "rev": "2447df5cc6e48eb965c3c3fba87e46d353b5e9f1", + "opts": {}, "name": "leanInk", - "inputRev?": "doc-gen"}}, + "inputRev?": "doc-gen", + "inherited": false}}, {"git": {"url": "https://github.com/leanprover/std4.git", "subDir?": null, - "rev": "dbffa8cb31b0c51b151453c4ff8f00ede2a84ed8", + "rev": "14e723aabf3165e2590572bb8fd7bd3243f25542", + "opts": {}, "name": "std", - "inputRev?": "main"}}]} + "inputRev?": "main", + "inherited": false}}]} diff --git a/lean-toolchain b/lean-toolchain index e4b4851..7884c5a 100644 --- a/lean-toolchain +++ b/lean-toolchain @@ -1 +1 @@ -leanprover/lean4:nightly-2023-08-03 \ No newline at end of file +leanprover/lean4:4.0.0 \ No newline at end of file diff --git a/static/style.css b/static/style.css index f8b37b6..5b5ea8e 100644 --- a/static/style.css +++ b/static/style.css @@ -709,13 +709,11 @@ pre code { padding: 0 0; } .inductive_ctor_doc { text-indent: 2ex; - padding-top: 1ex; font-family: 'Open Sans', sans-serif; } .structure_field_doc { text-indent: 0; - padding-top: 1ex; font-family: 'Open Sans', sans-serif; }