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  8f9f483f4c441a604e8fc0f121bae1f9d58cc777 (commit)
       via  28bc97662cc94572743c63d115ae6b25d7b03860 (commit)
      from  8d7d0f89fd6bc4e79c45ab45eb9b5ddf89f4bac1 (commit)


Summary of changes:
 heist.cabal                           |    2 +-
 src/Text/Templating/Heist/Internal.hs |   32 +++++++++++++++++++++-----------
 2 files changed, 22 insertions(+), 12 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 8f9f483f4c441a604e8fc0f121bae1f9d58cc777
Author: Mighty Byte <[email protected]>
Date:   Mon Jun 14 14:27:07 2010 -0400

    Bump version to 0.2.1

diff --git a/heist.cabal b/heist.cabal
index ccbdcac..60d4912 100644
--- a/heist.cabal
+++ b/heist.cabal
@@ -1,5 +1,5 @@
 name:           heist
-version:        0.2.0
+version:        0.2.1
 synopsis:       An xhtml templating system
 license:        BSD3
 license-file:   LICENSE
commit 28bc97662cc94572743c63d115ae6b25d7b03860
Author: Shane <[email protected]>
Date:   Mon Jun 14 19:22:27 2010 +0100

    Changed the behaviour of $() substitution again. Will now render non-text 
nodes as text using textContent.

diff --git a/src/Text/Templating/Heist/Internal.hs 
b/src/Text/Templating/Heist/Internal.hs
index 80f013f..7e5ec84 100644
--- a/src/Text/Templating/Heist/Internal.hs
+++ b/src/Text/Templating/Heist/Internal.hs
@@ -283,22 +283,32 @@ attParser = AP.many1 (identParser <|> litParser)
 
 
 ------------------------------------------------------------------------------
--- | Get's the attribute value.  This is just a normal splice lookup with the
--- added restriction that the splice's result list has to start with a list
--- of text elements.  Otherwise the attribute evaluates to the empty string.
+-- | Get's the attribute value.  If the splice's result list contains non-text
+-- nodes, this will translate them into text nodes with textContent and
+-- concatenate them together.
 --
--- This originally only took the first text node. However, because HTML 
--- entities will split a text node, and it might be desirable to have text
--- containing HTML entities in an attribute, it was decided instead to to
--- take the first few consecutive text nodes and concatenate them instead.
+-- Originally, this only took the first node from the splices's result list,
+-- and only if it was a text node. This caused problems when the splice's
+-- result contained HTML entities, as they would split a text node. This was
+-- 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
+-- \"some text foobar\" to be rendered, and Heist would probably seem
+-- annoyingly limited for not being able to do this. If the user really did
+-- want it to render \"some \", it would probably be easier for them to
+-- accept that they were silly to pass more than that to be substituted than
+-- it would be for the former user to accept that
+-- \"some \<b\>text\<\/b\> foobar\" is being rendered as \"some \" because
+-- it's \"more intuitive\".
 getAttributeSplice :: Monad m => ByteString -> TemplateMonad m ByteString
 getAttributeSplice name = do
     s <- liftM (lookupSplice name) getTS
     nodes <- maybe (return []) id s
-    return $ check nodes
-  where
-    check ((X.Text t):xs) = B.append t $ check xs
-    check _ = ""
+    return $ B.concat $ map X.textContent nodes
 
 ------------------------------------------------------------------------------
 -- | Performs splice processing on a list of nodes.
-----------------------------------------------------------------------


hooks/post-receive
-- 
heist
_______________________________________________
Snap mailing list
[email protected]
http://mailman-mail5.webfaction.com/listinfo/snap

Reply via email to