From: adam Date: Thu, 10 Apr 2008 16:34:52 +0000 (-0700) Subject: improve html escapification in \pre blocks X-Git-Url: http://git.megacz.com/?p=wix.git;a=commitdiff_plain;h=ee0d619aef56ddd0a03a430a809aa76a1d4fce59 improve html escapification in \pre blocks darcs-hash:20080410163452-5007d-3d3b87b400c14f2c0cac862b168a268ab68aab85.gz --- diff --git a/src/Html.lhs b/src/Html.lhs index 295f131..6fb939a 100644 --- a/src/Html.lhs +++ b/src/Html.lhs @@ -291,18 +291,18 @@ instance ToHtml Text where 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
"++ (pre' x) ++ "\n
\n" where pre' (' ':b) = " "++(pre' b) pre' ('\n':b) = "
\n"++(pre' b) - pre' (a:b) = a:(pre' b) + pre' (a:b) = (htmlEscapeChar a)++(pre' b) pre' [] = [] \end{code}