| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Text.Mustache.Compile
- compileTemplate :: [FilePath] -> FilePath -> IO (Either ParseError MustacheTemplate)
- compileTemplateWithCache :: [FilePath] -> [MustacheTemplate] -> FilePath -> IO (Either ParseError MustacheTemplate)
- parseTemplate :: String -> Text -> Either ParseError MustacheTemplate
- getPartials :: MustacheAST -> [FilePath]
- getPartials' :: MustacheNode Text -> [FilePath]
- getFile :: [FilePath] -> FilePath -> EitherT ParseError IO Text
- fileNotFound :: FilePath -> ParseError
Documentation
compileTemplate :: [FilePath] -> FilePath -> IO (Either ParseError MustacheTemplate) Source
Compiles a mustache template provided by name including the mentioned partials.
The same can be done manually using getFile, mustacheParser and getPartials.
This function also ensures each partial is only compiled once even though it may be included by other partials including itself.
A reference to the included template will be found in each including templates
partials section.
compileTemplateWithCache :: [FilePath] -> [MustacheTemplate] -> FilePath -> IO (Either ParseError MustacheTemplate) Source
Compile a mustache template providing a list of precompiled templates that do not have to be recompiled.
getPartials :: MustacheAST -> [FilePath] Source
Find the names of all included partials in a mustache AST.
Same as join . fmap getPartials'
getPartials' :: MustacheNode Text -> [FilePath] Source
Find partials in a single MustacheNode
getFile :: [FilePath] -> FilePath -> EitherT ParseError IO Text Source
getFile searchSpace file iteratively searches all directories in
searchSpace for a file returning it if found or raising an error if none
of the directories contain the file.
This trows ParseErrors to be compatible with the internal Either Monad of
compileTemplateWithCache.
fileNotFound :: FilePath -> ParseError Source