mustache-0.3.1.0: A mustache template parser library.

Copyright(c) Justus Adam, 2015
LicenseLGPL-3
Maintainerdev@justus.science
Stabilityexperimental
PortabilityPOSIX
Safe HaskellNone
LanguageHaskell2010

Text.Mustache.Render

Contents

Description

 

Synopsis

Substitution

substitute :: ToMustache κ => Template -> κ -> Text Source

Substitutes all mustache defined tokens (or tags) for values found in the provided data structure.

Equivalent to substituteValue . toMustache.

substituteValue :: Template -> Value -> Text Source

Substitutes all mustache defined tokens (or tags) for values found in the provided data structure.

Working with Context

data Context α Source

Representation of stateful context for the substitution process

Constructors

Context [α] α 

search :: Context Value -> [Key] -> Maybe Value Source

Search for a key in the current context.

The search is conducted inside out mening the current focus is searched first. If the key is not found the outer scopes are recursively searched until the key is found, then innerSearch is called on the result.

innerSearch :: [Key] -> Value -> Maybe Value Source

Searches nested scopes navigating inward. Fails if it encunters something other than an object before the key is expended.

Util

toString :: Value -> Text Source

Converts values to Text as required by the mustache standard