module Hakyllbars.Field.Html
( escapeHtmlField,
escapeHtmlUriField,
)
where
import Hakyllbars.Common
import Hakyllbars.Context
import Network.URI (escapeURIString, isUnescapedInURI)
escapeHtmlField :: Context String
escapeHtmlField :: Context String
escapeHtmlField = forall v a w.
(FromValue v a, IntoValue w a) =>
String -> (v -> TemplateRunner a w) -> Context a
functionField String
"escapeHtml" String -> StateT (TemplateState String) Compiler String
f
where
f :: String -> StateT (TemplateState String) Compiler String
f = forall (m :: * -> *) a. Monad m => a -> m a
return forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> String
escapeHtml
escapeHtmlUriField :: Context String
escapeHtmlUriField :: Context String
escapeHtmlUriField = forall v a w.
(FromValue v a, IntoValue w a) =>
String -> (v -> TemplateRunner a w) -> Context a
functionField String
"escapeHtmlUri" String -> StateT (TemplateState String) Compiler String
f
where
f :: String -> StateT (TemplateState String) Compiler String
f = forall (m :: * -> *) a. Monad m => a -> m a
return forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> String
escapeHtml forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Char -> Bool) -> String -> String
escapeURIString Char -> Bool
isUnescapedInURI