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 8f5ebb5b0a702ae183a3b43af94652ed0249f0f1 (commit)
from f8b93a404136e7678e3d420897d0515c194ac277 (commit)
Summary of changes:
src/Text/Templating/Heist.hs | 10 +++++-----
src/Text/Templating/Heist/Internal.hs | 18 ++++++++++--------
src/Text/Templating/Heist/Splices/Apply.hs | 5 +++--
src/Text/Templating/Heist/Splices/Static.hs | 6 +++---
4 files changed, 21 insertions(+), 18 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 8f5ebb5b0a702ae183a3b43af94652ed0249f0f1
Author: Mighty Byte <[email protected]>
Date: Sat Feb 5 14:09:14 2011 -0500
Style cleanup
diff --git a/src/Text/Templating/Heist.hs b/src/Text/Templating/Heist.hs
index bfaf0f3..17349e0 100644
--- a/src/Text/Templating/Heist.hs
+++ b/src/Text/Templating/Heist.hs
@@ -27,18 +27,18 @@
> import Data.Text (Text)
> import qualified Data.Text as T
> import qualified Text.XmlHtml as X
- >
+ >
> import Text.Templating.Heist
>
> link :: Text -> Text -> Node
> link target text = X.Element "a" [("href", target)] [X.TextNode text]
- >
+ >
> loginLink :: Node
> loginLink = link "/login" "Login"
- >
+ >
> logoutLink :: Text -> Node
> logoutLink user = link "/logout" (T.append "Logout " user)
- >
+ >
> loginLogoutSplice :: Splice MyAppMonad
> loginLogoutSplice = do
> user <- lift getUser
@@ -50,7 +50,7 @@
following code demonstrates how this splice would be used.
> mySplices = [ ("loginLogout", loginLogoutSplice) ]
- >
+ >
> main = do
> ets <- loadTemplates "templates" $
> foldr (uncurry bindSplice) emptyTemplateState mySplices
diff --git a/src/Text/Templating/Heist/Internal.hs
b/src/Text/Templating/Heist/Internal.hs
index c3a59f0..744ddee 100644
--- a/src/Text/Templating/Heist/Internal.hs
+++ b/src/Text/Templating/Heist/Internal.hs
@@ -88,7 +88,7 @@ bindSplices :: Monad m =>
[(Text, Splice m)] -- ^ splices to bind
-> TemplateState m -- ^ start state
-> TemplateState m
-bindSplices ss ts = foldl' (flip id) ts acts
+bindSplices ss ts = foldl' (flip id) ts acts
where
acts = map (uncurry bindSplice) ss
@@ -136,8 +136,8 @@ singleLookup tm path name = fmap (\a -> (a,path)) $
Map.lookup (name:path) tm
------------------------------------------------------------------------------
--- | Searches for a template by looking in the full path then backing up into
each
--- of the parent directories until the template is found.
+-- | Searches for a template by looking in the full path then backing up into
+-- each of the parent directories until the template is found.
traversePath :: TemplateMap
-> TPath
-> ByteString
@@ -163,7 +163,7 @@ lookupTemplate :: Monad m =>
ByteString
-> TemplateState m
-> Maybe (X.Document, TPath)
-lookupTemplate nameStr ts =
+lookupTemplate nameStr ts =
f (_templateMap ts) path name
where (name:p) = case splitTemplatePath nameStr of
[] -> [""]
@@ -241,7 +241,7 @@ setContext c = modifyTS (\st -> st { _curContext = c })
-- | Gets the current context
getContext :: Monad m => TemplateMonad m TPath
getContext = getsTS _curContext
-
+
------------------------------------------------------------------------------
-- | Performs splice processing on a single node.
@@ -314,7 +314,7 @@ attParser = AP.many1 (identParser <|> litParser)
-- then fixed to take the first consecutive bunch of text nodes, and return
-- their concatenation. This was seen as more useful than throwing an error,
-- and more intuitive than trying to render all the nodes as text.
---
+--
-- However, it was decided in the end to render all the nodes as text, and
-- then concatenate them. If a splice returned
-- \"some \<b\>text\<\/b\> foobar\", the user would almost certainly want
@@ -569,7 +569,8 @@ loadTemplate templateRoot fname
------------------------------------------------------------------------------
-- | Traverses the specified directory structure and builds a
-- TemplateState by loading all the files with a ".tpl" or ".xtpl" extension.
-loadTemplates :: Monad m => FilePath -> TemplateState m -> IO (Either String
(TemplateState m))
+loadTemplates :: Monad m => FilePath -> TemplateState m
+ -> IO (Either String (TemplateState m))
loadTemplates dir ts = do
d <- readDirectoryWith (loadTemplate dir) dir
let tlist = F.fold (free d)
@@ -592,7 +593,8 @@ runHook f t = do
------------------------------------------------------------------------------
-- | Runs the onLoad hook on the template and returns the `TemplateState`
-- with the result inserted.
-loadHook :: Monad m => TemplateState m -> (TPath, X.Document) -> IO
(TemplateState m)
+loadHook :: Monad m => TemplateState m -> (TPath, X.Document)
+ -> IO (TemplateState m)
loadHook ts (tp, t) = do
t' <- runHook (_onLoadHook ts) t
return $ insertTemplate tp t' ts
diff --git a/src/Text/Templating/Heist/Splices/Apply.hs
b/src/Text/Templating/Heist/Splices/Apply.hs
index 755f44f..07365cd 100644
--- a/src/Text/Templating/Heist/Splices/Apply.hs
+++ b/src/Text/Templating/Heist/Splices/Apply.hs
@@ -32,13 +32,14 @@ applyImpl = do
node <- getParamNode
case X.getAttribute applyAttr node of
Nothing -> return [] -- TODO: error handling
- Just attr -> do
+ Just attr -> do
st <- getTS
maybe (return []) -- TODO: error handling
(\(t,ctx) -> do
addDoctype $ maybeToList $ X.docType t
processedChildren <- runNodeList $ X.childNodes node
- modifyTS (bindSplice "content" $ return
processedChildren)
+ modifyTS (bindSplice "content" $
+ return processedChildren)
setContext ctx
result <- runNodeList $ X.docContent t
restoreTS st
diff --git a/src/Text/Templating/Heist/Splices/Static.hs
b/src/Text/Templating/Heist/Splices/Static.hs
index f132cb1..42782bf 100644
--- a/src/Text/Templating/Heist/Splices/Static.hs
+++ b/src/Text/Templating/Heist/Splices/Static.hs
@@ -1,6 +1,6 @@
{-# LANGUAGE OverloadedStrings #-}
-module Text.Templating.Heist.Splices.Static
+module Text.Templating.Heist.Splices.Static
( StaticTagState
, bindStaticTag
, clearStaticTagCache
@@ -40,8 +40,8 @@ clearStaticTagCache (STS staticMVar) =
------------------------------------------------------------------------------
--- | The \"static\" splice ensures that its contents are evaluated once and
then
--- cached. The cached contents are returned every time the splice is
+-- | The \"static\" splice ensures that its contents are evaluated once and
+-- then cached. The cached contents are returned every time the splice is
-- referenced.
staticImpl :: (MonadIO m)
=> StaticTagState
-----------------------------------------------------------------------
hooks/post-receive
--
heist
_______________________________________________
Snap mailing list
[email protected]
http://mailman-mail5.webfaction.com/listinfo/snap