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 } {} {}
def loadCore : IO (Process.AnalyzerResult × Hierarchy) := do
load <| .loadAll [`Init, `Lean]
load <| .loadAll [`Init, `Lean, `Lake]
end DocGen4

View File

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

View File

@ -18,8 +18,8 @@ def fieldToHtml (f : Process.NameInfo) : HtmlM Html := do
let renderedDoc ← docStringToHtml doc
pure
<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_doc">[renderedDoc]</div>
</li>
else
pure

View File

@ -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)

View File

@ -190,16 +190,18 @@ 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"
modifiers := modifiers.push "def"
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 := #[]

View File

@ -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}}]}

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 {
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;
}