IHaskell.Eval.Lint: escape $

This commit is contained in:
Vaibhav Sagar 2019-10-18 11:01:21 -04:00
parent f48eeee91c
commit c13b973a46
2 changed files with 6 additions and 5 deletions

View File

@ -212,12 +212,13 @@ htmlSuggestions = concatMap toHtml
[ named $ suggestion suggest
, floating "left" $ styl severityClass "Found:" ++
-- Things that look like this get highlighted.
styleId "highlight-code" "haskell" (found suggest)
styleId "highlight-code" "haskell" (escapeDollar $ found suggest)
, floating "left" $ styl severityClass "Why Not:" ++
-- Things that look like this get highlighted.
styleId "highlight-code" "haskell" (whyNot suggest)
styleId "highlight-code" "haskell" (escapeDollar $ whyNot suggest)
]
where
escapeDollar = replace "$" "\\$"
severityClass =
case severity suggest of
Error -> "error"

View File

@ -894,14 +894,14 @@
".suggestion-name {\n",
"font-weight: bold;\n",
"}\n",
"</style><div class=\"suggestion-name\" style=\"clear:both;\">Redundant $</div><div class=\"suggestion-row\" style=\"float: left;\"><div class=\"suggestion-warning\">Found:</div><div class=\"highlight-code\" id=\"haskell\">f $ 3</div></div><div class=\"suggestion-row\" style=\"float: left;\"><div class=\"suggestion-warning\">Why Not:</div><div class=\"highlight-code\" id=\"haskell\">f 3</div></div><div class=\"suggestion-name\" style=\"clear:both;\">Redundant do</div><div class=\"suggestion-row\" style=\"float: left;\"><div class=\"suggestion-warning\">Found:</div><div class=\"highlight-code\" id=\"haskell\">do return 3</div></div><div class=\"suggestion-row\" style=\"float: left;\"><div class=\"suggestion-warning\">Why Not:</div><div class=\"highlight-code\" id=\"haskell\">return 3</div></div>"
"</style><div class=\"suggestion-name\" style=\"clear:both;\">Redundant $</div><div class=\"suggestion-row\" style=\"float: left;\"><div class=\"suggestion-warning\">Found:</div><div class=\"highlight-code\" id=\"haskell\">f \\$ 3</div></div><div class=\"suggestion-row\" style=\"float: left;\"><div class=\"suggestion-warning\">Why Not:</div><div class=\"highlight-code\" id=\"haskell\">f 3</div></div><div class=\"suggestion-name\" style=\"clear:both;\">Redundant do</div><div class=\"suggestion-row\" style=\"float: left;\"><div class=\"suggestion-warning\">Found:</div><div class=\"highlight-code\" id=\"haskell\">do return 3</div></div><div class=\"suggestion-row\" style=\"float: left;\"><div class=\"suggestion-warning\">Why Not:</div><div class=\"highlight-code\" id=\"haskell\">return 3</div></div>"
],
"text/plain": [
"Line 1: Redundant $\n",
"Line 7: Redundant $\n",
"Found:\n",
"f $ 3\n",
"Why not:\n",
"f 3Line 1: Redundant do\n",
"f 3Line 9: Redundant do\n",
"Found:\n",
"do return 3\n",
"Why not:\n",