StrappedTemplates-0.1.0.0: General purpose templates in haskell

Safe HaskellNone
LanguageHaskell98

Text.Strapped

Contents

Synopsis

Rendering

render :: MonadIO m => RenderConfig -> InputBucket m -> String -> m (Either StrapError Output) Source

Using a TemplateStore and an InputBucket render the template name.

defaultConfig :: RenderConfig Source

Default render configuration. No text escaping.

Controlling variables

combineBuckets :: InputBucket m -> InputBucket m -> InputBucket m Source

If the first bucket fails, try the second.

varBucket :: String -> Input m -> InputBucket m Source

Basic bucket. Matches on string and return input. Returns Nothing for everything else.

Parsing

parseTemplate :: String -> String -> Either ParseError Template Source

Take a template body and a template name and return either an error or a renderable template.

TemplateLoading

templateStoreFromDirectory :: FilePath -> String -> IO (Either ParseError TemplateStore) Source

Given a file path and extension, load all templates in a directory, recursively.