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

import Data.Monoid
import Text.HTML.Moe2.Backend.ByteString
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]


(/) :: (Monad m) => m ()
(/) = return ()