fix: Dont linkify unknown names

main
Henrik Böving 2022-08-11 23:19:31 +02:00
parent cdfd8ff49c
commit d43b23ec9f
1 changed files with 15 additions and 11 deletions

View File

@ -212,17 +212,21 @@ partial def infoFormatToHtml (i : CodeWithInfos) : HtmlM (Array Html) := do
| TaggedText.tag a t => | TaggedText.tag a t =>
match a.info.val.info with match a.info.val.info with
| Info.ofTermInfo i => | Info.ofTermInfo i =>
match i.expr.consumeMData with let cleanExpr := i.expr.consumeMData
| Expr.const name _ => if let Expr.const name _ := cleanExpr then
match t with -- TODO: this is some very primitive blacklisting but real Blacklisting needs MetaM
| TaggedText.text t => -- find a better solution
let (front, t, back) := splitWhitespaces <| Html.escape t if (←getResult).name2ModIdx.contains name then
let elem := <a href={←declNameToLink name}>{t}</a> match t with
pure #[Html.text front, elem, Html.text back] | TaggedText.text t =>
| _ => let (front, t, back) := splitWhitespaces <| Html.escape t
-- TODO: Is this ever reachable? let elem := <a href={←declNameToLink name}>{t}</a>
pure #[<a href={←declNameToLink name}>[←infoFormatToHtml t]</a>] pure #[Html.text front, elem, Html.text back]
| _ => | _ =>
pure #[<a href={←declNameToLink name}>[←infoFormatToHtml t]</a>]
else
pure #[<span class="fn">[←infoFormatToHtml t]</span>]
else
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>]