packages feed

mustache 2.2.1 → 2.2.2

raw patch · 3 files changed

+10/−2 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Text.Mustache.Render: catchSubstitute :: SubM a -> SubM (a, Text)

Files

CHANGELOG.md view
@@ -1,5 +1,9 @@ # Mustache library changelog +## v2.2.2++- Added a function to catch a substitution result+ ## v2.2.1  - Quickfix for an issue with resolving in context
mustache.cabal view
@@ -1,5 +1,5 @@ name:                mustache-version:             2.2.1+version:             2.2.2 synopsis:            A mustache template parser library. description:   Allows parsing and rendering template files with mustache markup. See the
src/Text/Mustache/Render.hs view
@@ -19,7 +19,7 @@   -- * Checked substitution   , checkedSubstitute, checkedSubstituteValue, SubstitutionError(..)   -- * Working with Context-  , Context(..), search, innerSearch, SubM, substituteNode, substituteAST+  , Context(..), search, innerSearch, SubM, substituteNode, substituteAST, catchSubstitute   -- * Util   , toString   ) where@@ -100,6 +100,10 @@ checkedSubstituteValue :: Template -> Value -> ([SubstitutionError], Text) checkedSubstituteValue template dataStruct =   second T.concat $ runSubM (substituteAST (ast template)) (Context mempty dataStruct) (partials template)++-- | Catch the results of running the inner substitution.+catchSubstitute :: SubM a -> SubM (a, Text)+catchSubstitute = fmap (second (T.concat . snd)) . SubM . listen . runSubM'  -- | Substitute an entire 'STree' rather than just a single 'Node' substituteAST :: STree -> SubM ()