wai-hastache-0.1: Nice wrapper around hastache for use with WAI

Safe HaskellSafe-Infered

Network.Wai.Hastache

Synopsis

Documentation

hastache :: (Functor m, MonadIO m) => Status -> ResponseHeaders -> MuConfig -> FilePath -> MuContext m -> m ResponseSource

Build a response based on a configuration and a template in a file.

hastacheHTML :: (Functor m, MonadIO m) => Status -> ResponseHeaders -> FilePath -> MuContext m -> m ResponseSource

Build an HTML-escaped response based on a template in a file. Defaults Content-Type to text/html if you do not specify.

hastacheText :: (Functor m, MonadIO m) => Status -> ResponseHeaders -> FilePath -> MuContext m -> m ResponseSource

Build an unescaped response based on a template in a file. Defaults Content-Type to text/plain if you do not specify.

hastacheStr :: (Functor m, MonadIO m) => Status -> ResponseHeaders -> MuConfig -> ByteString -> MuContext m -> m ResponseSource

Build a response based on a configuration and a template in a ByteString.

hastacheStrHTML :: (Functor m, MonadIO m) => Status -> ResponseHeaders -> ByteString -> MuContext m -> m ResponseSource

Build an HTML-escaped response based on a template in a ByteString. Defaults Content-Type to text/html if you do not specify.

hastacheStrText :: (Functor m, MonadIO m) => Status -> ResponseHeaders -> ByteString -> MuContext m -> m ResponseSource

Build an unescaped response based on a template in a ByteString. Defaults Content-Type to text/plain if you do not specify.

data MuConfig

Constructors

MuConfig 

Fields

muEscapeFunc :: ByteString -> ByteString

Escape function (htmlEscape, emptyEscape etc.)

muTemplateFileDir :: Maybe FilePath

Directory for search partial templates ({{> templateName}})

muTemplateFileExt :: Maybe String

Partial template files extension

type MuContext m

Arguments

 = ByteString

Variable name

-> MuType m

Value

Data for Hastache variable

data MuType m where

Constructors

MuVariable :: MuVar a => a -> MuType m 
MuList :: [MuContext m] -> MuType m 
MuBool :: Bool -> MuType m 
MuLambda :: MuVar a => (ByteString -> a) -> MuType m 
MuLambdaM :: MuVar a => (ByteString -> m a) -> MuType m 
MuNothing :: MuType m 

Instances

Show (MuType m)