Copyright | © 2016–2018 Stack Builders |
---|---|
License | BSD 3 clause |
Maintainer | Mark Karpov <markkarpov92@gmail.com> |
Stability | experimental |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
Mustache Template
creation from file or a Text
value. You don't
usually need to import the module, because Text.Mustache re-exports
everything you may need, import that module instead.
Synopsis
- compileMustacheDir :: MonadIO m => PName -> FilePath -> m Template
- compileMustacheDir' :: MonadIO m => (FilePath -> Bool) -> PName -> FilePath -> m Template
- getMustacheFilesInDir :: MonadIO m => FilePath -> m [FilePath]
- getMustacheFilesInDir' :: MonadIO m => (FilePath -> Bool) -> FilePath -> m [FilePath]
- isMustacheFile :: FilePath -> Bool
- compileMustacheFile :: MonadIO m => FilePath -> m Template
- compileMustacheText :: PName -> Text -> Either (ParseErrorBundle Text Void) Template
Documentation
:: MonadIO m | |
=> PName | Which template to select after compiling |
-> FilePath | Directory with templates |
-> m Template | The resulting template |
Compile all templates in specified directory and select one. Template
files should have the extension mustache
, (e.g. foo.mustache
) to be
recognized. This function does not scan the directory recursively.
The action can throw the same exceptions as getDirectoryContents
, and
readFile
.
compileMustacheDir = complieMustacheDir' isMustacheFile
:: MonadIO m | |
=> (FilePath -> Bool) | Template selection predicate |
-> PName | Which template to select after compiling |
-> FilePath | Directory with templates |
-> m Template | The resulting template |
The same as compileMustacheDir
, but allows using a custom predicate
for template selection.
Since: stache-1.2.0
getMustacheFilesInDir Source #
Return a list of templates found in given directory. The returned paths are absolute.
Since: stache-0.2.2
getMustacheFilesInDir' Source #
:: MonadIO m | |
=> (FilePath -> Bool) | Mustache file selection predicate |
-> FilePath | Directory with templates |
-> m [FilePath] |
Return a list of templates found via a predicate in given directory. The returned paths are absolute.
Since: stache-1.2.0
isMustacheFile :: FilePath -> Bool Source #
The default Mustache file predicate.
Since: stache-1.2.0
Compile a single Mustache template and select it.
The action can throw the same exceptions as readFile
.