HSmarty-0.2.0.3: Small template engine

Safe HaskellNone
LanguageHaskell98

Text.HSmarty

Synopsis

Documentation

data TemplateParam Source

An template param, construct using mkParam

type ParamMap = HashMap Text TemplateParam Source

Maps template variables to template params

mkParam :: ToJSON a => a -> TemplateParam Source

Pack a value as a template param

newtype SmartyError Source

Constructors

SmartyError 

Fields

unSmartyError :: Text
 

prepareTemplate :: FilePath -> IO SmartyCtx Source

Parse and compile a template

applyTemplate :: SmartyCtx -> ParamMap -> IO (Either SmartyError Text) Source

Fill a template with values and print it as Text

renderTemplate :: FilePath -> ParamMap -> IO (Either SmartyError Text) Source

Render a template using the specified ParamMap. Results in either an error-message or the rendered template. DO NOT USE IN Production. Use prepareTemplate and applyTemplate instead.