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 "snap".
The branch, master has been updated
via 34d7fc488e0aaf1433de4c278166ead7323366b5 (commit)
from f21befeb446744e5ca29e3d89c687779f3897d81 (commit)
Summary of changes:
src/Snap/Heist.hs | 17 +++++++++++++++--
1 files changed, 15 insertions(+), 2 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 34d7fc488e0aaf1433de4c278166ead7323366b5
Author: Carl Howells <[email protected]>
Date: Thu Jul 1 16:44:50 2010 -0700
Add documentation for Snap.Heist
diff --git a/src/Snap/Heist.hs b/src/Snap/Heist.hs
index 9325f49..881d0ff 100644
--- a/src/Snap/Heist.hs
+++ b/src/Snap/Heist.hs
@@ -1,6 +1,9 @@
{-# LANGUAGE OverloadedStrings #-}
+-- | This module contains convenience functions for helping render
+-- Heist templates from Snap.
module Snap.Heist where
+------------------------------------------------------------------------------
import qualified Data.ByteString.Char8 as S
import Snap.Error
@@ -9,12 +12,22 @@ import Snap.Types
import Text.Templating.Heist
+------------------------------------------------------------------------------
+-- | This is a convenience function. It calls 'render' with the
+-- content type set to @text/html; charset=ut...@.
renderHtml :: (MonadSnap m) => TemplateState m -> S.ByteString -> m ()
renderHtml = render "text/html; charset=utf-8"
-render :: (MonadSnap m) =>
- S.ByteString -> TemplateState m -> S.ByteString -> m ()
+------------------------------------------------------------------------------
+-- | Renders a template with the provided content type. If the
+-- template cannot be loaded, 'internalError' is called with an error
+-- message.
+render :: (MonadSnap m)
+ => S.ByteString -- ^ the content type to include in the response
+ -> TemplateState m -- ^ the TemplateState that contains the template
+ -> S.ByteString -- ^ the name of the template
+ -> m ()
render contentType ts template = do
bytes <- renderTemplate ts template
flip (maybe missingTemplate) bytes $ \x -> do
-----------------------------------------------------------------------
hooks/post-receive
--
snap
_______________________________________________
Snap mailing list
[email protected]
http://mailman-mail5.webfaction.com/listinfo/snap