kontrakcja-templates-0.11: Utilities for working with many HStringTemplate templates from files.

Safe HaskellNone
LanguageHaskell2010

Text.StringTemplates.TemplatesLoader

Description

Module for reading templates from files

Synopsis

Documentation

type Templates = STGroup String Source #

Group of string templates

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

readGlobalTemplates Source #

Arguments

:: (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).

renderTemplateMain Source #

Arguments

:: 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

getTemplatesModTime Source #

Arguments

:: FilePath

path to dir containing .csv files with template files

-> FilePath

dir path to recursively scan for .st files containing string templates

-> IO UTCTime 

Returns the latest modification time across all template files