improve html escapification in \pre blocks
authoradam <adam@megacz.com>
Thu, 10 Apr 2008 16:34:52 +0000 (09:34 -0700)
committeradam <adam@megacz.com>
Thu, 10 Apr 2008 16:34:52 +0000 (09:34 -0700)
darcs-hash:20080410163452-5007d-3d3b87b400c14f2c0cac862b168a268ab68aab85.gz

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}