git @ Cat's Eye Technologies Quylthulg / 31f0365
Escape HTML characters in output. Chris Pressey 1 year, 4 months ago
1 changed file(s) with 7 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
77
88 main = withElems ["prog", "result", "run-button"] driver
99
10 escapeHTML "" = ""
11 escapeHTML ('<' : rest) = "&lt;" ++ escapeHTML rest
12 escapeHTML ('>' : rest) = "&gt;" ++ escapeHTML rest
13 escapeHTML ('&' : rest) = "&amp;" ++ escapeHTML rest
14 escapeHTML (c : rest) = (c : escapeHTML rest)
15
1016 driver [progElem, resultElem, runButtonElem] = do
1117 onEvent runButtonElem Click $ \_ -> execute
1218 where
1319 execute = do
1420 Just prog <- getValue progElem
15 setProp resultElem "innerHTML" (showRun prog)
21 setProp resultElem "innerHTML" (escapeHTML $ showRun prog)