module HTMLEntities.Text where import qualified Data.Text as Text import HTMLEntities.Prelude -- | -- HTML-encodes the given char. char :: Char -> Text char = \case '<' -> "<" '>' -> ">" '&' -> "&" '"' -> """ '\'' -> "'" x -> Text.singleton x -- | -- HTML-encodes the given text. -- -- >>> Data.Text.IO.putStrLn $ text "" -- <a href=""> text :: Text -> Text text = Text.concatMap char