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, 0.2-dev has been updated
via a0ffa12803130934ea0a88fc60ff7e864b496df8 (commit)
from 1ad9656b474e20b2d37d8408db31b47249234bb0 (commit)
Summary of changes:
src/Text/Templating/Heist/Internal.hs | 13 +++++++++++++
1 files changed, 13 insertions(+), 0 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 a0ffa12803130934ea0a88fc60ff7e864b496df8
Author: Mighty Byte <[email protected]>
Date: Mon May 31 10:53:47 2010 -0400
Added comments to attribute code.
diff --git a/src/Text/Templating/Heist/Internal.hs
b/src/Text/Templating/Heist/Internal.hs
index 7e809d2..0a6c983 100644
--- a/src/Text/Templating/Heist/Internal.hs
+++ b/src/Text/Templating/Heist/Internal.hs
@@ -383,6 +383,9 @@ runNode n@(X.Element nm at ch) = do
return (n,v')
+------------------------------------------------------------------------------
+-- | Parses an attribute with attribute variable substitution.
+parseAtt :: Monad m => ByteString -> TemplateMonad m ByteString
parseAtt bs
| B.null bs = return B.empty
| otherwise = let (pre,rest) = B.span (/='{') bs in do
@@ -393,7 +396,12 @@ parseAtt bs
return $ B.append a c
return $ B.append pre suffix
+
------------------------------------------------------------------------------
+-- | Parses an attribute variable token. This token starts immediately after
+-- the opening '{' and extends to the corresponding closing '}'. The return
+-- value is a tuple of the token's substituted value and the rest of the
+-- ByteString to be parsed (starting immediately after the closing '}').
parseVar :: Monad m => ByteString -> ByteString
-> TemplateMonad m (ByteString, ByteString)
parseVar pre bs
@@ -407,6 +415,11 @@ parseVar pre bs
_ -> do s <- getAttributeSplice $ B.append pre name
return (s, B.tail rest)
+
+------------------------------------------------------------------------------
+-- | Get's the attribute value. This is just a normal splice lookup with the
+-- added restriction that the splice's result list has to contain a single
+-- text element. Otherwise the attribute evaluates to the empty string.
getAttributeSplice :: Monad m => ByteString -> TemplateMonad m ByteString
getAttributeSplice name = do
s <- liftM (lookupSplice name) get
-----------------------------------------------------------------------
hooks/post-receive
--
heist
_______________________________________________
Snap mailing list
[email protected]
http://mailman-mail5.webfaction.com/listinfo/snap