feat: autolink references to files

main
Ruben Van de Velde 2023-09-13 21:56:04 +02:00 committed by Henrik Böving
parent f9b5a2903a
commit 19568c0659
1 changed files with 3 additions and 1 deletions

View File

@ -70,7 +70,9 @@ partial def xmlGetHeadingId (el : Xml.Element) : String :=
-/ -/
def nameToLink? (s : String) : HtmlM (Option String) := do def nameToLink? (s : String) : HtmlM (Option String) := do
let res ← getResult let res ← getResult
if let some name := Lean.Syntax.decodeNameLit ("`" ++ s) then if s.endsWith ".lean" && s.contains '/' then
return (← getRoot) ++ s.dropRight 5 ++ ".html"
else if let some name := Lean.Syntax.decodeNameLit ("`" ++ s) then
-- with exactly the same name -- with exactly the same name
if res.name2ModIdx.contains name then if res.name2ModIdx.contains name then
declNameToLink name declNameToLink name