Copyright | © 2016–2017 Stack Buliders |
---|---|
License | BSD 3 clause |
Maintainer | Mark Karpov <markkarpov@openmailbox.org> |
Stability | experimental |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
Types used by the package. You don't usually need to import the module, because Text.Microstache re-exports everything you may need, import that module instead.
- data Template = Template {
- templateActual :: PName
- templateCache :: Map PName [Node]
- data Node
- newtype Key = Key {}
- showKey :: Key -> Text
- newtype PName = PName {}
- data MustacheException
- displayMustacheException :: MustacheException -> String
- data MustacheWarning
- displayMustacheWarning :: MustacheWarning -> String
Documentation
Mustache template as name of “top-level” template and a collection of all available templates (partials).
Template
is a Semigroup
. This means that you can combine Template
s
(and their caches) using the (
operator, the resulting <>
)Template
will have the same currently selected template as the left one. Union of
caches is also left-biased.
Template | |
|
Structural element of template.
Identifier for values to interpolate.
The representation is the following:
[]
— empty list means implicit iterators;[text]
— single key is a normal identifier;[text1, text2]
— multiple keys represent dotted names.
showKey :: Key -> Text Source #
Pretty-print a key, this is helpful, for example, if you want to display an error message.
Identifier for partials. Note that with the OverloadedStrings
extension you can use just string literals to create values of this type.
data MustacheException Source #
Exception that is thrown when parsing of a template has failed or referenced values were not provided.
MustacheParserException ParseError | Template parser has failed. This contains the parse error. |
MustacheRenderException PName Key | Deprecated: Not thrown anymore, will be removed in the next major version of microstache A referenced value was not provided. The exception provides info
about partial in which the issue happened |
displayMustacheException :: MustacheException -> String Source #
Since: 1.0.1
data MustacheWarning Source #
Since: 1.0.1
MustacheVariableNotFound Key | The template contained a variable for which there was no data counterpart in the current context |
MustacheDirectlyRenderedValue Key | A complex value such as an Object or Array was directly rendered into the template |
displayMustacheWarning :: MustacheWarning -> String Source #
Since: 1.0.1