This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "heist".
The branch, master has been updated
via 1a017e11579c011eaec16280bb6588d22ed96eb3 (commit)
from 269668f0ddacc7fe73523f747853a050e4daee62 (commit)
Summary of changes:
heist.cabal | 4 ++--
src/Text/Templating/Heist.hs | 1 +
src/Text/Templating/Heist/Constants.hs | 4 ++--
src/Text/Templating/Heist/Internal.hs | 21 +++++++++++++++++++--
src/Text/Templating/Heist/Splices/Apply.hs | 1 -
src/Text/Templating/Heist/Splices/Bind.hs | 1 -
src/Text/Templating/Heist/Types.hs | 10 +++++-----
7 files changed, 29 insertions(+), 13 deletions(-)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 1a017e11579c011eaec16280bb6588d22ed96eb3
Author: Mighty Byte <[email protected]>
Date: Fri Dec 3 08:19:31 2010 -0500
Added renderWithArgs and upgraded from monads-fd to mtl 2.
diff --git a/heist.cabal b/heist.cabal
index 377d48a..07dad59 100644
--- a/heist.cabal
+++ b/heist.cabal
@@ -1,5 +1,5 @@
name: heist
-version: 0.2.5
+version: 0.3.0.0
synopsis: An xhtml templating system
license: BSD3
license-file: LICENSE
@@ -97,7 +97,7 @@ Library
filepath,
hexpat >= 0.19 && <0.20,
MonadCatchIO-transformers >= 0.2.1 && < 0.3,
- monads-fd == 0.1.0.2,
+ mtl >= 2.0 && < 2.1,
process,
random,
transformers
diff --git a/src/Text/Templating/Heist.hs b/src/Text/Templating/Heist.hs
index 0898d86..8214587 100644
--- a/src/Text/Templating/Heist.hs
+++ b/src/Text/Templating/Heist.hs
@@ -105,6 +105,7 @@ module Text.Templating.Heist
, evalTemplate
, callTemplate
, renderTemplate
+ , renderWithArgs
, bindStrings
, bindString
diff --git a/src/Text/Templating/Heist/Constants.hs
b/src/Text/Templating/Heist/Constants.hs
index aaba486..13ad69d 100644
--- a/src/Text/Templating/Heist/Constants.hs
+++ b/src/Text/Templating/Heist/Constants.hs
@@ -9,9 +9,9 @@ import Text.XML.Expat.Tree
------------------------------------------------------------------------------
-- | 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)
}
diff --git a/src/Text/Templating/Heist/Internal.hs
b/src/Text/Templating/Heist/Internal.hs
index f4dcea2..ebf31e5 100644
--- a/src/Text/Templating/Heist/Internal.hs
+++ b/src/Text/Templating/Heist/Internal.hs
@@ -8,8 +8,9 @@ module Text.Templating.Heist.Internal where
------------------------------------------------------------------------------
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 qualified Data.Foldable as F
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 @@ bindString n v = bindSplice n $ return [X.Text v]
------------------------------------------------------------------------------
-- | 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
@@ -459,6 +462,20 @@ renderTemplate ts name = do
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
------------------------------------------------------------------------------
diff --git a/src/Text/Templating/Heist/Splices/Apply.hs
b/src/Text/Templating/Heist/Splices/Apply.hs
index de71a5d..a0d68df 100644
--- a/src/Text/Templating/Heist/Splices/Apply.hs
+++ b/src/Text/Templating/Heist/Splices/Apply.hs
@@ -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
diff --git a/src/Text/Templating/Heist/Splices/Bind.hs
b/src/Text/Templating/Heist/Splices/Bind.hs
index 37cd2a2..40f98a6 100644
--- a/src/Text/Templating/Heist/Splices/Bind.hs
+++ b/src/Text/Templating/Heist/Splices/Bind.hs
@@ -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
diff --git a/src/Text/Templating/Heist/Types.hs
b/src/Text/Templating/Heist/Types.hs
index 941dcbb..1eef319 100644
--- a/src/Text/Templating/Heist/Types.hs
+++ b/src/Text/Templating/Heist/Types.hs
@@ -23,11 +23,11 @@ module Text.Templating.Heist.Types where
------------------------------------------------------------------------------
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)
-----------------------------------------------------------------------
hooks/post-receive
--
heist
_______________________________________________
Snap mailing list
[email protected]
http://mailman-mail5.webfaction.com/listinfo/snap