feat: update Links
This commit is contained in:
parent
84b328f13f
commit
a5c72fe32c
2 changed files with 9 additions and 1 deletions
|
@ -80,6 +80,13 @@ def Imports.getLines (imp : Import) : IO (Array String) := do
|
|||
def Name.toFile (c : Name) : MetaM String := do
|
||||
return s!"./{c.toString.replace "." "/" ++ ".lean"}"
|
||||
|
||||
/-- Turns a name, which represents a module, into a link to github. -/
|
||||
def Name.toGitHubLink (c : Name) (l : Nat := 0) : MetaM String := do
|
||||
let headerLink := "https://github.com/HEPLean/HepLean/blob/master/"
|
||||
let filePart := (c.toString.replace "." "/") ++ ".lean"
|
||||
let linePart := "#L" ++ toString l
|
||||
return headerLink ++ filePart ++ linePart
|
||||
|
||||
/-- Given a name, returns the line number. -/
|
||||
def Name.lineNumber (c : Name) : MetaM Nat := do
|
||||
match ← findDeclarationRanges? c with
|
||||
|
|
|
@ -45,11 +45,12 @@ unsafe def HTMLNote.ofInformal (name : Name) : MetaM HTMLNote := do
|
|||
let line ← Name.lineNumber name
|
||||
let fileName ← Name.fileName name
|
||||
let constInfo ← getConstInfo name
|
||||
let webAddress : String ← Name.toGitHubLink fileName line
|
||||
let mut content := ""
|
||||
if Informal.isInformalDef constInfo then
|
||||
let X ← Informal.constantInfoToInformalDefinition constInfo
|
||||
content := "<div class=\"informal-def\">"
|
||||
++ "<a href=\"https://example.com\" class=\"button\">Improve/Formalize</a>"
|
||||
++ "<a href=\"" ++ webAddress ++ "\" class=\"button\">Improve/Formalize</a>"
|
||||
++"<b>Informal definition:</b> " ++ name.toString ++ "<br>"
|
||||
++ X.math.replace "\n" "<br>"
|
||||
++ "</div>"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue