Text.Hastache
Description
Haskell implementation of Mustache templates
See homepage for examples of usage: http://github.com/lymar/hastache
- hastacheStr :: MonadIO m => MuConfig -> ByteString -> MuContext m -> m ByteString
- hastacheFile :: MonadIO m => MuConfig -> FilePath -> MuContext m -> m ByteString
- hastacheStrBuilder :: MonadIO m => MuConfig -> ByteString -> MuContext m -> m Builder
- hastacheFileBuilder :: MonadIO m => MuConfig -> FilePath -> MuContext m -> m Builder
- type MuContext m = ByteString -> MuType m
- data MuType m
- = forall a . MuVar a => MuVariable a
- | MuList [MuContext m]
- | MuBool Bool
- | MuLambda (ByteString -> ByteString)
- | MuLambdaM (ByteString -> m ByteString)
- | MuNothing
- data MuConfig = MuConfig {}
- class Show a => MuVar a
- htmlEscape :: ByteString -> ByteString
- emptyEscape :: ByteString -> ByteString
- defaultConfig :: MuConfig
- encodeStr :: String -> ByteString
- encodeStrLBS :: String -> ByteString
- decodeStr :: ByteString -> String
- decodeStrLBS :: ByteString -> String
Documentation
Arguments
| :: MonadIO m | |
| => MuConfig | Configuration |
| -> ByteString | Template |
| -> MuContext m | Context |
| -> m ByteString |
Render Hastache template from ByteString
Arguments
| :: MonadIO m | |
| => MuConfig | Configuration |
| -> FilePath | Template file name |
| -> MuContext m | Context |
| -> m ByteString |
Render Hastache template from file
Arguments
| :: MonadIO m | |
| => MuConfig | Configuration |
| -> ByteString | Template |
| -> MuContext m | Context |
| -> m Builder |
Render Hastache template from ByteString
Arguments
| :: MonadIO m | |
| => MuConfig | Configuration |
| -> FilePath | Template file name |
| -> MuContext m | Context |
| -> m Builder |
Render Hastache template from file
Arguments
| = ByteString | Variable name |
| -> MuType m | Value |
Data for Hastache variable
Constructors
| forall a . MuVar a => MuVariable a | |
| MuList [MuContext m] | |
| MuBool Bool | |
| MuLambda (ByteString -> ByteString) | |
| MuLambdaM (ByteString -> m ByteString) | |
| MuNothing |
Constructors
| MuConfig | |
Fields
| |
htmlEscape :: ByteString -> ByteStringSource
Escape HTML symbols
emptyEscape :: ByteString -> ByteStringSource
No escape
defaultConfig :: MuConfigSource
Default config: HTML escape function, current directory as template directory, template file extension not specified
encodeStr :: String -> ByteStringSource
Convert String to UTF-8 Bytestring
encodeStrLBS :: String -> ByteStringSource
Convert String to UTF-8 Lazy Bytestring
decodeStr :: ByteString -> StringSource
Convert UTF-8 Bytestring to String
decodeStrLBS :: ByteString -> StringSource
Convert UTF-8 Lazy Bytestring to String