heist 0.2.4 → 0.3.0.0
raw patch · 7 files changed
+29/−13 lines, 7 filesdep +mtldep −monads-fdPVP ok
version bump matches the API change (PVP)
Dependencies added: mtl
Dependencies removed: monads-fd
API changes (from Hackage documentation)
+ Text.Templating.Heist: renderWithArgs :: Monad m => [(ByteString, ByteString)] -> TemplateState m -> ByteString -> m (Maybe ByteString)
Files
- heist.cabal +2/−2
- src/Text/Templating/Heist.hs +1/−0
- src/Text/Templating/Heist/Constants.hs +2/−2
- src/Text/Templating/Heist/Internal.hs +19/−2
- src/Text/Templating/Heist/Splices/Apply.hs +0/−1
- src/Text/Templating/Heist/Splices/Bind.hs +0/−1
- src/Text/Templating/Heist/Types.hs +5/−5
heist.cabal view
@@ -1,5 +1,5 @@ name: heist-version: 0.2.4+version: 0.3.0.0 synopsis: An xhtml templating system license: BSD3 license-file: LICENSE@@ -97,7 +97,7 @@ filepath, hexpat >= 0.19 && <0.20, MonadCatchIO-transformers >= 0.2.1 && < 0.3,- monads-fd,+ mtl >= 2.0 && < 2.1, process, random, transformers
src/Text/Templating/Heist.hs view
@@ -105,6 +105,7 @@ , evalTemplate , callTemplate , renderTemplate+ , renderWithArgs , bindStrings , bindString
src/Text/Templating/Heist/Constants.hs view
@@ -9,9 +9,9 @@ ------------------------------------------------------------------------------ -- | Options passed to hexpat for XML parsing.-heistExpatOptions :: ParserOptions ByteString ByteString+heistExpatOptions :: ParseOptions ByteString ByteString heistExpatOptions =- defaultParserOptions {+ defaultParseOptions { overrideEncoding = Just UTF8 , entityDecoder = Just (\k -> Map.lookup k htmlEntityLookupTable) }
src/Text/Templating/Heist/Internal.hs view
@@ -8,8 +8,9 @@ ------------------------------------------------------------------------------ import Control.Applicative import Control.Exception (SomeException)+import Control.Monad import Control.Monad.CatchIO-import "monads-fd" Control.Monad.RWS.Strict+import Control.Monad.Trans import qualified Data.Attoparsec.Char8 as AP import Data.ByteString.Char8 (ByteString) import qualified Data.ByteString.Char8 as B@@ -19,6 +20,7 @@ import Data.List import qualified Data.Map as Map import Data.Maybe+import Data.Monoid import Prelude hiding (catch) import System.Directory.Tree hiding (name) import System.FilePath@@ -413,7 +415,8 @@ ------------------------------------------------------------------------------ -- | Renders a template with the specified parameters. This is the function--- to use when you want to "call" a template and pass in parameters from code.+-- to use when you want to "call" a template and pass in parameters from+-- inside a splice. callTemplate :: Monad m => ByteString -- ^ The name of the template -> [(ByteString, ByteString)] -- ^ Association list of@@ -458,6 +461,20 @@ (\t -> liftM Just $ renderInternal =<< toInternalTemplate t) mt ) (X.Text "") ts+++------------------------------------------------------------------------------+-- | Renders a template with the specified arguments passed to it. This is a+-- convenience function for the common pattern of calling renderTemplate after+-- using bindString, bindStrings, or bindSplice to set up the arguments to the+-- template.+renderWithArgs :: Monad m+ => [(ByteString, ByteString)]+ -> TemplateState m+ -> ByteString+ -> m (Maybe ByteString)+renderWithArgs args ts = renderTemplate (bindStrings args ts)+ ------------------------------------------------------------------------------ -- Template loading
src/Text/Templating/Heist/Splices/Apply.hs view
@@ -3,7 +3,6 @@ module Text.Templating.Heist.Splices.Apply where -------------------------------------------------------------------------------import Control.Monad.RWS.Strict import Data.ByteString.Char8 (ByteString) import qualified Data.ByteString.Char8 as B import Data.Maybe
src/Text/Templating/Heist/Splices/Bind.hs view
@@ -3,7 +3,6 @@ module Text.Templating.Heist.Splices.Bind where -------------------------------------------------------------------------------import Control.Monad.RWS.Strict import Data.ByteString.Char8 (ByteString) import qualified Text.XML.Expat.Tree as X
src/Text/Templating/Heist/Types.hs view
@@ -23,11 +23,11 @@ ------------------------------------------------------------------------------ import Control.Applicative-import "monads-fd" Control.Monad.Cont-import "monads-fd" Control.Monad.Error-import "monads-fd" Control.Monad.Reader-import "monads-fd" Control.Monad.State-import "monads-fd" Control.Monad.Trans+import Control.Monad.Cont+import Control.Monad.Error+import Control.Monad.Reader+import Control.Monad.State+import Control.Monad.Trans import Data.ByteString.Char8 (ByteString) import qualified Data.Map as Map import Data.Map (Map)