Update to doc-gen4 commit `9efe8f1`.

finite-set-exercises
Joshua Potter 2023-09-08 14:19:34 -06:00
parent e7a8d7ea3c
commit b9b54fce14
9 changed files with 80 additions and 50 deletions

View File

@ -56,6 +56,6 @@ def load (task : Process.AnalyzeTask) : IO (Process.AnalyzerResult × Hierarchy)
Prod.fst <$> Meta.MetaM.toIO (Process.process task) config { env := env } {} {} Prod.fst <$> Meta.MetaM.toIO (Process.process task) config { env := env } {} {}
def loadCore : IO (Process.AnalyzerResult × Hierarchy) := do def loadCore : IO (Process.AnalyzerResult × Hierarchy) := do
load <| .loadAll [`Init, `Lean] load <| .loadAll [`Init, `Lean, `Lake]
end DocGen4 end DocGen4

View File

@ -22,8 +22,8 @@ def ctorToHtml (c : Process.NameInfo) : HtmlM Html := do
let renderedDoc ← docStringToHtml doc let renderedDoc ← docStringToHtml doc
pure pure
<li class="constructor" id={name}> <li class="constructor" id={name}>
<div class="inductive_ctor_doc">[renderedDoc]</div>
{shortName} : [← infoFormatToHtml c.type] {shortName} : [← infoFormatToHtml c.type]
<div class="inductive_ctor_doc">[renderedDoc]</div>
</li> </li>
else else
pure pure

View File

@ -74,8 +74,8 @@ def sourceLinker (ws : Lake.Workspace) : IO (Name → Option DeclarationRange
|>.toIO (fun _ => IO.userError "Failed to load lake manifest") |>.toIO (fun _ => IO.userError "Failed to load lake manifest")
for pkg in manifest.entryArray do for pkg in manifest.entryArray do
match pkg with match pkg with
| .git _ url rev .. => gitMap := gitMap.insert pkg.name (getGithubBaseUrl url, rev) | .git _ _ _ url rev .. => gitMap := gitMap.insert pkg.name (getGithubBaseUrl url, rev)
| .path _ path => | .path _ _ _ path =>
let pkgBaseUrl := getGithubBaseUrl (← getProjectGithubUrl path) let pkgBaseUrl := getGithubBaseUrl (← getProjectGithubUrl path)
let pkgCommit ← getProjectCommit path let pkgCommit ← getProjectCommit path
gitMap := gitMap.insert pkg.name (pkgBaseUrl, pkgCommit) 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 root := module.getRoot
let basic := if root == `Lean root == `Init then let basic := if root == `Lean root == `Init then
s!"https://github.com/leanprover/lean4/blob/{leanHash}/src/{path}.lean" 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 else
match ws.packageArray.find? (·.isLocalModule module) with match ws.packageArray.find? (·.isLocalModule module) with
| some pkg => | some pkg =>

View File

@ -18,8 +18,8 @@ def fieldToHtml (f : Process.NameInfo) : HtmlM Html := do
let renderedDoc ← docStringToHtml doc let renderedDoc ← docStringToHtml doc
pure pure
<li id={name} class="structure_field"> <li id={name} class="structure_field">
<div class="structure_field_doc">[renderedDoc]</div>
<div class="structure_field_info">{s!"{shortName} "} : [← infoFormatToHtml f.type]</div> <div class="structure_field_info">{s!"{shortName} "} : [← infoFormatToHtml f.type]</div>
<div class="structure_field_doc">[renderedDoc]</div>
</li> </li>
else else
pure pure

View File

@ -62,34 +62,42 @@ open Compiler in
instance : ToString InlineAttributeKind where instance : ToString InlineAttributeKind where
toString kind := toString kind :=
match kind with match kind with
| InlineAttributeKind.inline => "inline" | .inline => "inline"
| InlineAttributeKind.noinline => "noinline" | .noinline => "noinline"
| InlineAttributeKind.macroInline => "macro_inline" | .macroInline => "macro_inline"
| InlineAttributeKind.inlineIfReduce => "inline_if_reduce" | .inlineIfReduce => "inline_if_reduce"
| InlineAttributeKind.alwaysInline => "always_inline" | .alwaysInline => "always_inline"
open Compiler in open Compiler in
instance : ToString SpecializeAttributeKind where instance : ToString SpecializeAttributeKind where
toString kind := toString kind :=
match kind with match kind with
| SpecializeAttributeKind.specialize => "specialize" | .specialize => "specialize"
| SpecializeAttributeKind.nospecialize => "nospecialize" | .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. 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 instance : ToString ExternEntry where
toString entry := toString entry :=
match entry with match entry with
| ExternEntry.adhoc `all => "" | .adhoc `all => ""
| ExternEntry.adhoc backend => s!"{backend} adhoc" | .adhoc backend => s!"{backend} adhoc"
| ExternEntry.standard `all fn => fn | .standard `all fn => fn
| ExternEntry.standard backend fn => s!"{backend} {fn}" | .standard backend fn => s!"{backend} {fn}"
| ExternEntry.inline backend pattern => s!"{backend} inline {String.quote pattern}" | .inline backend pattern => s!"{backend} inline {String.quote pattern}"
-- TODO: The docs in the module dont specific how to render this -- 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 instance : ToString ExternAttrData where
toString data := (data.arity?.map toString |>.getD "") ++ " " ++ String.intercalate " " (data.entries.map toString) toString data := (data.arity?.map toString |>.getD "") ++ " " ++ String.intercalate " " (data.entries.map toString)

View File

@ -190,16 +190,18 @@ def getKindDescription : DocInfo → String
| DefinitionSafety.unsafe => "unsafe opaque" | DefinitionSafety.unsafe => "unsafe opaque"
| DefinitionSafety.partial => "partial def" | DefinitionSafety.partial => "partial def"
| definitionInfo i => Id.run do | definitionInfo i => Id.run do
if i.hints.isAbbrev then
return "abbrev"
else
let mut modifiers := #[] let mut modifiers := #[]
if i.isUnsafe then if i.isUnsafe then
modifiers := modifiers.push "unsafe" modifiers := modifiers.push "unsafe"
if i.isNonComputable then if i.isNonComputable then
modifiers := modifiers.push "noncomputable" modifiers := modifiers.push "noncomputable"
modifiers := modifiers.push "def" let defKind :=
if i.hints.isAbbrev then
"abbrev"
else
"def"
modifiers := modifiers.push defKind
return String.intercalate " " modifiers.toList return String.intercalate " " modifiers.toList
| instanceInfo i => Id.run do | instanceInfo i => Id.run do
let mut modifiers := #[] let mut modifiers := #[]

View File

@ -1,63 +1,83 @@
{"version": 4, {"version": 5,
"packagesDir": "lake-packages", "packagesDir": "lake-packages",
"packages": "packages":
[{"git": [{"git":
{"url": "https://github.com/xubaiw/CMark.lean", {"url": "https://github.com/xubaiw/CMark.lean",
"subDir?": null, "subDir?": null,
"rev": "0077cbbaa92abf855fc1c0413e158ffd8195ec77", "rev": "0077cbbaa92abf855fc1c0413e158ffd8195ec77",
"opts": {},
"name": "CMark", "name": "CMark",
"inputRev?": "main"}}, "inputRev?": "main",
"inherited": false}},
{"git": {"git":
{"url": "https://github.com/EdAyers/ProofWidgets4", {"url": "https://github.com/EdAyers/ProofWidgets4",
"subDir?": null, "subDir?": null,
"rev": "a0c2cd0ac3245a0dade4f925bcfa97e06dd84229", "rev": "a0c2cd0ac3245a0dade4f925bcfa97e06dd84229",
"opts": {},
"name": "proofwidgets", "name": "proofwidgets",
"inputRev?": "v0.0.13"}}, "inputRev?": "v0.0.13",
"inherited": true}},
{"git": {"git":
{"url": "https://github.com/leanprover/lake", {"url": "https://github.com/leanprover/lake",
"subDir?": null, "subDir?": null,
"rev": "a2ced44b7e5e30c2a6b84b420e1bbdd8d6d8e079", "rev": "a2ced44b7e5e30c2a6b84b420e1bbdd8d6d8e079",
"opts": {},
"name": "lake", "name": "lake",
"inputRev?": "master"}}, "inputRev?": "master",
"inherited": false}},
{"git": {"git":
{"url": "https://github.com/fgdorais/lean4-unicode-basic", {"url": "https://github.com/fgdorais/lean4-unicode-basic",
"subDir?": null, "subDir?": null,
"rev": "f09250282cea3ed8c010f430264d9e8e50d7bc32", "rev": "2491e781ae478b6e6f1d86a7157f1c58fc50f895",
"name": "lean4-unicode-basic", "opts": {},
"inputRev?": "main"}}, "name": "«lean4-unicode-basic»",
"inputRev?": "main",
"inherited": false}},
{"git": {"git":
{"url": "https://github.com/mhuisi/lean4-cli", {"url": "https://github.com/mhuisi/lean4-cli",
"subDir?": null, "subDir?": null,
"rev": "5a858c32963b6b19be0d477a30a1f4b6c120be7e", "rev": "21dac2e9cc7e3cf7da5800814787b833e680b2fd",
"opts": {},
"name": "Cli", "name": "Cli",
"inputRev?": "nightly"}}, "inputRev?": "nightly",
"inherited": false}},
{"git": {"git":
{"url": "https://github.com/leanprover-community/mathlib4.git", {"url": "https://github.com/leanprover-community/mathlib4.git",
"subDir?": null, "subDir?": null,
"rev": "280a9f50ed49fc27396d06d438fde63691818268", "rev": "d04897a61efc29f2393f448154f212472c91b47d",
"opts": {},
"name": "mathlib", "name": "mathlib",
"inputRev?": "master"}}, "inputRev?": "master",
"inherited": false}},
{"git": {"git":
{"url": "https://github.com/gebner/quote4", {"url": "https://github.com/gebner/quote4",
"subDir?": null, "subDir?": null,
"rev": "81cc13c524a68d0072561dbac276cd61b65872a6", "rev": "e75daed95ad1c92af4e577fea95e234d7a8401c1",
"opts": {},
"name": "Qq", "name": "Qq",
"inputRev?": "master"}}, "inputRev?": "master",
"inherited": true}},
{"git": {"git":
{"url": "https://github.com/JLimperg/aesop", {"url": "https://github.com/JLimperg/aesop",
"subDir?": null, "subDir?": null,
"rev": "d13a9666e6f430b940ef8d092f1219e964b52a09", "rev": "1a0cded2be292b5496e659b730d2accc742de098",
"opts": {},
"name": "aesop", "name": "aesop",
"inputRev?": "master"}}, "inputRev?": "master",
"inherited": true}},
{"git": {"git":
{"url": "https://github.com/hargonix/LeanInk", {"url": "https://github.com/hargonix/LeanInk",
"subDir?": null, "subDir?": null,
"rev": "2447df5cc6e48eb965c3c3fba87e46d353b5e9f1", "rev": "2447df5cc6e48eb965c3c3fba87e46d353b5e9f1",
"opts": {},
"name": "leanInk", "name": "leanInk",
"inputRev?": "doc-gen"}}, "inputRev?": "doc-gen",
"inherited": false}},
{"git": {"git":
{"url": "https://github.com/leanprover/std4.git", {"url": "https://github.com/leanprover/std4.git",
"subDir?": null, "subDir?": null,
"rev": "dbffa8cb31b0c51b151453c4ff8f00ede2a84ed8", "rev": "14e723aabf3165e2590572bb8fd7bd3243f25542",
"opts": {},
"name": "std", "name": "std",
"inputRev?": "main"}}]} "inputRev?": "main",
"inherited": false}}]}

View File

@ -1 +1 @@
leanprover/lean4:nightly-2023-08-03 leanprover/lean4:4.0.0

View File

@ -709,13 +709,11 @@ pre code { padding: 0 0; }
.inductive_ctor_doc { .inductive_ctor_doc {
text-indent: 2ex; text-indent: 2ex;
padding-top: 1ex;
font-family: 'Open Sans', sans-serif; font-family: 'Open Sans', sans-serif;
} }
.structure_field_doc { .structure_field_doc {
text-indent: 0; text-indent: 0;
padding-top: 1ex;
font-family: 'Open Sans', sans-serif; font-family: 'Open Sans', sans-serif;
} }