instance ToHtml String where
toHtml s = concatMap htmlEscapeChar s
- where
- htmlEscapeChar '<' = "<"
- htmlEscapeChar '>' = ">"
- htmlEscapeChar '&' = "&"
- htmlEscapeChar '\'' = "'"
- htmlEscapeChar '\"' = """
- htmlEscapeChar c = [c]
+
+htmlEscapeChar '<' = "<"
+htmlEscapeChar '>' = ">"
+htmlEscapeChar '&' = "&"
+htmlEscapeChar '\'' = "'"
+htmlEscapeChar '\"' = """
+htmlEscapeChar c = [c]
pre x = "\n<div class=pre>"++ (pre' x) ++ "\n</div>\n"
where
pre' (' ':b) = " "++(pre' b)
pre' ('\n':b) = "<br/>\n"++(pre' b)
- pre' (a:b) = a:(pre' b)
+ pre' (a:b) = (htmlEscapeChar a)++(pre' b)
pre' [] = []
\end{code}