[Snap Framework] heist branch, master, updated. 8ddb3008ed8357f2fc3c557e3ecd209caed5d36f

noreply at snapframework.com noreply at snapframework.com
Tue Feb 8 07:58:49 CST 2011


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  8ddb3008ed8357f2fc3c557e3ecd209caed5d36f (commit)
      from  2e98bd51a19115f8971764598a8fecabf36b872b (commit)


Summary of changes:
 src/Text/Templating/Heist.hs |   13 +++++++------
 1 files changed, 7 insertions(+), 6 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 8ddb3008ed8357f2fc3c557e3ecd209caed5d36f
Author: Mighty Byte <mightybyte at gmail.com>
Date:   Tue Feb 8 08:58:25 2011 -0500

    Applied documentation patch from Peter Eriksen.

diff --git a/src/Text/Templating/Heist.hs b/src/Text/Templating/Heist.hs
index 17349e0..d3cb298 100644
--- a/src/Text/Templating/Heist.hs
+++ b/src/Text/Templating/Heist.hs
@@ -22,6 +22,7 @@
   @getUser :: MyAppMonad (Maybe Text)@ that gets the current user.
   You can implement this functionality with a 'Splice' as follows:
 
+  > import             Blaze.ByteString.Builder
   > import             Data.ByteString.Char8 (ByteString)
   > import qualified   Data.ByteString.Char8 as B
   > import             Data.Text (Text)
@@ -30,19 +31,19 @@
   >
   > import             Text.Templating.Heist
   >
-  > link :: Text -> Text -> Node
+  > link :: Text -> Text -> X.Node
   > link target text = X.Element "a" [("href", target)] [X.TextNode text]
   >
-  > loginLink :: Node
+  > loginLink :: X.Node
   > loginLink = link "/login" "Login"
   >
-  > logoutLink :: Text -> Node
+  > logoutLink :: Text -> X.Node
   > logoutLink user = link "/logout" (T.append "Logout " user)
   >
   > loginLogoutSplice :: Splice MyAppMonad
   > loginLogoutSplice = do
   >     user <- lift getUser
-  >     return $ [maybe loginLink logoutLink user]
+  >     return [maybe loginLink logoutLink user]
   >
 
   Next, you need to bind that splice to a tag.  Heist stores information
@@ -53,10 +54,10 @@
   >
   > main = do
   >     ets <- loadTemplates "templates" $
-  >            foldr (uncurry bindSplice) emptyTemplateState mySplices
+  >            bindSplices mySplices (emptyTemplateState "templates")
   >     let ts = either error id ets
   >     t <- runMyAppMonad $ renderTemplate ts "index"
-  >     print $ maybe "Page not found" id t
+  >     print $ maybe "Page not found" (toByteString . fst) t
 
   Here we build up our 'TemplateState' by starting with emptyTemplateState and
   applying bindSplice for all the splices we want to add.  Then we pass this
-----------------------------------------------------------------------


hooks/post-receive
-- 
heist


More information about the Snap mailing list