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 471d73bec1fd89a9715a5aed5c656ff6ca3ab124 (commit)
from 215ad02abc7a19b193818585e155100a5e40177c (commit)
Summary of changes:
src/Text/Templating/Heist.hs | 1 +
src/Text/Templating/Heist/Internal.hs | 21 +++------------------
src/Text/Templating/Heist/Splices/Apply.hs | 2 +-
src/Text/Templating/Heist/Types.hs | 13 +++++++++++++
4 files changed, 18 insertions(+), 19 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 471d73bec1fd89a9715a5aed5c656ff6ca3ab124
Author: Gregory Collins <[email protected]>
Date: Fri Jun 18 01:49:30 2010 -0400
Export restoreTS.
diff --git a/src/Text/Templating/Heist.hs b/src/Text/Templating/Heist.hs
index 24fcb90..96a4ddd 100644
--- a/src/Text/Templating/Heist.hs
+++ b/src/Text/Templating/Heist.hs
@@ -95,6 +95,7 @@ module Text.Templating.Heist
, getTS
, putTS
, modifyTS
+ , restoreTS
-- * Functions for running splices and templates
, evalTemplate
diff --git a/src/Text/Templating/Heist/Internal.hs
b/src/Text/Templating/Heist/Internal.hs
index 4201acb..0d18b1d 100644
--- a/src/Text/Templating/Heist/Internal.hs
+++ b/src/Text/Templating/Heist/Internal.hs
@@ -31,21 +31,6 @@ import Text.Templating.Heist.Types
------------------------------------------------------------------------------
--- | Restores the components of TemplateState that can get modified in
--- template calls. You should use this function instead of @putTS@ to restore
--- an old state. Thas was needed because doctypes needs to be in a "global
--- scope" as opposed to the template call "local scope" of state items such
--- as recursionDepth, curContext, and spliceMap.
-restoreState :: Monad m => TemplateState m -> TemplateMonad m ()
-restoreState ts1 =
- modifyTS (\ts2 -> ts2
- { _recursionDepth = _recursionDepth ts1
- , _curContext = _curContext ts1
- , _spliceMap = _spliceMap ts1
- })
-
-
-------------------------------------------------------------------------------
-- | Mappends a doctype to the state.
addDoctype :: Monad m => [ByteString] -> TemplateMonad m ()
addDoctype dt = do
@@ -343,7 +328,7 @@ recurseSplice node splice = do
if _recurse ts' && _recursionDepth ts' < mAX_RECURSION_DEPTH
then do modRecursionDepth (+1)
res <- runNodeList result
- restoreState ts'
+ restoreTS ts'
return res
else return result
where
@@ -374,7 +359,7 @@ evalTemplate name = lookupAndRun name
ts <- getTS
putTS (ts {_curContext = ctx})
res <- runNodeList $ _itNodes t
- restoreState ts
+ restoreTS ts
return $ Just res)
@@ -391,7 +376,7 @@ evalWithHooks name = lookupAndRun name
nodes <- lift $ _preRunHook ts $ _itNodes t
putTS (ts {_curContext = ctx})
res <- runNodeList nodes
- restoreState ts
+ restoreTS ts
return . Just =<< lift (_postRunHook ts res))
diff --git a/src/Text/Templating/Heist/Splices/Apply.hs
b/src/Text/Templating/Heist/Splices/Apply.hs
index 3a95618..de71a5d 100644
--- a/src/Text/Templating/Heist/Splices/Apply.hs
+++ b/src/Text/Templating/Heist/Splices/Apply.hs
@@ -41,7 +41,7 @@ applyImpl = do
modifyTS (bindSplice "content" $ return
processedChildren)
setContext ctx
result <- runNodeList $ _itNodes t
- restoreState st
+ restoreTS st
return result)
(lookupTemplate attr (st {_curContext = nextCtx attr st}))
where nextCtx name st
diff --git a/src/Text/Templating/Heist/Types.hs
b/src/Text/Templating/Heist/Types.hs
index df38ffd..2737980 100644
--- a/src/Text/Templating/Heist/Types.hs
+++ b/src/Text/Templating/Heist/Types.hs
@@ -354,3 +354,16 @@ modifyTS :: Monad m
modifyTS f = TemplateMonad $ \_ s -> return ((), f s)
+------------------------------------------------------------------------------
+-- | Restores the components of TemplateState that can get modified in
+-- template calls. You should use this function instead of @putTS@ to restore
+-- an old state. Thas was needed because doctypes needs to be in a "global
+-- scope" as opposed to the template call "local scope" of state items such
+-- as recursionDepth, curContext, and spliceMap.
+restoreTS :: Monad m => TemplateState m -> TemplateMonad m ()
+restoreTS ts1 =
+ modifyTS (\ts2 -> ts2
+ { _recursionDepth = _recursionDepth ts1
+ , _curContext = _curContext ts1
+ , _spliceMap = _spliceMap ts1
+ })
-----------------------------------------------------------------------
hooks/post-receive
--
heist
_______________________________________________
Snap mailing list
[email protected]
http://mailman-mail5.webfaction.com/listinfo/snap