Safe Haskell | None |
---|---|
Language | Haskell2010 |
Module for reading templates from files
Synopsis
- type Templates = STGroup String
- type GlobalTemplates = Map String Templates
- localizedVersion :: String -> GlobalTemplates -> Templates
- readGlobalTemplates :: (MonadIO m, MonadFail m) => FilePath -> FilePath -> String -> m GlobalTemplates
- renderTemplateMain :: ToSElem a => Templates -> String -> [(String, a)] -> (StringTemplate String -> StringTemplate String) -> String
- getTemplatesModTime :: FilePath -> FilePath -> IO UTCTime
Documentation
type GlobalTemplates = Map String Templates Source #
Global map of templates (for a project), indexed by a language name (for text string templates, see TextTemplates for doc)
localizedVersion :: String -> GlobalTemplates -> Templates Source #
Retrieve templates for specified language name
:: (MonadIO m, MonadFail m) | |
=> FilePath | dir path to recursively scan for .json files containing text templates |
-> FilePath | dir path to recursively scan for .st files containing string templates |
-> String | default language. We can guarantee that empty language texts will be replaced |
-> m GlobalTemplates |
Reads text templates and templates from files (see TextTemplates and Files modules docs respectively).
:: ToSElem a | |
=> Templates | group of templates |
-> String | template name |
-> [(String, a)] | named template params |
-> (StringTemplate String -> StringTemplate String) | additional template altering function |
-> String | rendered template |
main template rendering function.
renders template by name (it's an error to render template that's not present in templates group),
and using list of named template params. simple noescape
template is added for convenience