improve html escapification in \pre blocks
[wix.git] / src / Html.lhs
index 295f131..6fb939a 100644 (file)
@@ -291,18 +291,18 @@ instance ToHtml Text where
 
 instance ToHtml String where
   toHtml s = concatMap htmlEscapeChar s
-   where
-     htmlEscapeChar '<'  = "&lt;"
-     htmlEscapeChar '>'  = "&gt;"
-     htmlEscapeChar '&'  = "&amp;"
-     htmlEscapeChar '\'' = "&apos;"
-     htmlEscapeChar '\"' = "&quot;"
-     htmlEscapeChar c    = [c]
+
+htmlEscapeChar '<'  = "&lt;"
+htmlEscapeChar '>'  = "&gt;"
+htmlEscapeChar '&'  = "&amp;"
+htmlEscapeChar '\'' = "&apos;"
+htmlEscapeChar '\"' = "&quot;"
+htmlEscapeChar c    = [c]
 
 pre x = "\n<div class=pre>"++ (pre' x) ++ "\n</div>\n"
  where
   pre' (' ':b)         = "&nbsp;"++(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}