module Text.HTML.Moe.Utils 
( escape
, (+)
, module Text.HTML.Moe.Backend.ByteString
) where

import Prelude hiding ((+))
import Data.Monoid
import Text.HTML.Moe.Backend.ByteString

escape :: String -> String
escape = escape_html

escape_html :: String -> String
escape_html = concatMap fixChar
  where
    fixChar '&'  = "&"
    fixChar '<'  = "&lt;"
    fixChar '>'  = "&gt;"
    fixChar '\'' = "&#39;"
    fixChar '"'  = "&quot;"
    fixChar x    = [x]

(+) :: (Monoid a) => a -> a -> a
(+) = mappend
infixl 5 +