feat: linkify builtin types
parent
b22818b971
commit
72034b0831
|
@ -207,18 +207,19 @@ to as much information as possible.
|
||||||
-/
|
-/
|
||||||
partial def infoFormatToHtml (i : CodeWithInfos) : HtmlM (Array Html) := do
|
partial def infoFormatToHtml (i : CodeWithInfos) : HtmlM (Array Html) := do
|
||||||
match i with
|
match i with
|
||||||
| TaggedText.text t => pure #[Html.escape t]
|
| .text t => pure #[Html.escape t]
|
||||||
| TaggedText.append tt => tt.foldlM (λ acc t => do pure <| acc ++ (←infoFormatToHtml t)) #[]
|
| .append tt => tt.foldlM (λ acc t => do pure <| acc ++ (←infoFormatToHtml t)) #[]
|
||||||
| TaggedText.tag a t =>
|
| .tag a t =>
|
||||||
match a.info.val.info with
|
match a.info.val.info with
|
||||||
| Info.ofTermInfo i =>
|
| Info.ofTermInfo i =>
|
||||||
let cleanExpr := i.expr.consumeMData
|
let cleanExpr := i.expr.consumeMData
|
||||||
if let Expr.const name _ := cleanExpr then
|
match cleanExpr with
|
||||||
|
| .const name _ =>
|
||||||
-- TODO: this is some very primitive blacklisting but real Blacklisting needs MetaM
|
-- TODO: this is some very primitive blacklisting but real Blacklisting needs MetaM
|
||||||
-- find a better solution
|
-- find a better solution
|
||||||
if (←getResult).name2ModIdx.contains name then
|
if (←getResult).name2ModIdx.contains name then
|
||||||
match t with
|
match t with
|
||||||
| TaggedText.text t =>
|
| .text t =>
|
||||||
let (front, t, back) := splitWhitespaces <| Html.escape t
|
let (front, t, back) := splitWhitespaces <| Html.escape t
|
||||||
let elem := <a href={←declNameToLink name}>{t}</a>
|
let elem := <a href={←declNameToLink name}>{t}</a>
|
||||||
pure #[Html.text front, elem, Html.text back]
|
pure #[Html.text front, elem, Html.text back]
|
||||||
|
@ -226,7 +227,17 @@ partial def infoFormatToHtml (i : CodeWithInfos) : HtmlM (Array Html) := do
|
||||||
pure #[<a href={←declNameToLink name}>[←infoFormatToHtml t]</a>]
|
pure #[<a href={←declNameToLink name}>[←infoFormatToHtml t]</a>]
|
||||||
else
|
else
|
||||||
pure #[<span class="fn">[←infoFormatToHtml t]</span>]
|
pure #[<span class="fn">[←infoFormatToHtml t]</span>]
|
||||||
else
|
| .sort _ =>
|
||||||
|
match t with
|
||||||
|
| .text t =>
|
||||||
|
let mut sortPrefix :: rest := t.splitOn " " | unreachable!
|
||||||
|
let sortLink := <a href={s!"{← getRoot}foundational_types.html"}>{sortPrefix}</a>
|
||||||
|
if rest != [] then
|
||||||
|
rest := " " :: rest
|
||||||
|
pure #[sortLink, Html.text <| String.join rest]
|
||||||
|
| _ =>
|
||||||
|
pure #[<a href={s!"{← getRoot}foundational_types.html"}>[← infoFormatToHtml t]</a>]
|
||||||
|
| _ =>
|
||||||
pure #[<span class="fn">[←infoFormatToHtml t]</span>]
|
pure #[<span class="fn">[←infoFormatToHtml t]</span>]
|
||||||
| _ => pure #[<span class="fn">[←infoFormatToHtml t]</span>]
|
| _ => pure #[<span class="fn">[←infoFormatToHtml t]</span>]
|
||||||
|
|
||||||
|
|
|
@ -5,9 +5,9 @@ namespace DocGen4.Output
|
||||||
|
|
||||||
open scoped DocGen4.Jsx
|
open scoped DocGen4.Jsx
|
||||||
|
|
||||||
def foundationalTypes : BaseHtmlM Html := templateLiftExtends (baseHtml "Foundational Type") do
|
def foundationalTypes : BaseHtmlM Html := templateLiftExtends (baseHtml "Foundational Types") do
|
||||||
pure <|
|
pure <|
|
||||||
<div class="docfile">
|
<main>
|
||||||
<a id="top"></a>
|
<a id="top"></a>
|
||||||
<h1>Foundational Types</h1>
|
<h1>Foundational Types</h1>
|
||||||
|
|
||||||
|
@ -45,6 +45,6 @@ def foundationalTypes : BaseHtmlM Html := templateLiftExtends (baseHtml "Foundat
|
||||||
<p>Note that despite not itself being a function, <code>(→)</code> is available as infix notation for
|
<p>Note that despite not itself being a function, <code>(→)</code> is available as infix notation for
|
||||||
<code>{"λ α β, α → β"}</code>.</p>
|
<code>{"λ α β, α → β"}</code>.</p>
|
||||||
-- TODO: instnaces for pi types
|
-- TODO: instnaces for pi types
|
||||||
</div>
|
</main>
|
||||||
|
|
||||||
end DocGen4.Output
|
end DocGen4.Output
|
||||||
|
|
|
@ -89,6 +89,7 @@ def baseDirBlackList : HashSet String :=
|
||||||
"find",
|
"find",
|
||||||
"how-about.js",
|
"how-about.js",
|
||||||
"index.html",
|
"index.html",
|
||||||
|
"foundational_types.html",
|
||||||
"mathjax-config.js",
|
"mathjax-config.js",
|
||||||
"navbar.html",
|
"navbar.html",
|
||||||
"nav.js",
|
"nav.js",
|
||||||
|
|
Loading…
Reference in New Issue