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

import Data.Monoid
import Text.HTML.Moe.Backend.ByteString
import Text.HTML.Moe2.Type
import Prelude hiding ((/), (+))

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]


(/) :: MoeUnit
(/) = return ()

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