Browse files

Changed attribute syntax to not interfere with jquery.

  • Loading branch information...
1 parent 0f08c40 commit 8340c3735a0d80b6c5f0a71f7a2351074311107a @mightybyte mightybyte committed Nov 20, 2011
View
4 src/Text/Templating/Heist/Internal.hs
@@ -393,8 +393,8 @@ attParser = AP.many1 (identParser <|> litParser)
escChar = (AP.char '\\' *> AP.anyChar) <|>
AP.satisfy (AP.notInClass "\\$")
litParser = Literal <$> (T.pack <$> AP.many1 escChar)
- identParser = AP.string "$(" *>
- (Ident <$> AP.takeWhile (/=')')) <* AP.string ")"
+ identParser = AP.string "${" *>
+ (Ident <$> AP.takeWhile (/='}')) <* AP.string "}"
------------------------------------------------------------------------------
View
4 test/suite/Text/Templating/Heist/Tests.hs
@@ -197,7 +197,7 @@ attrSubstTest = do
H.assertBool ("attr subst " ++ (show str)) $ not $ B.null $
snd $ B.breakSubstring str $ toByteString $ resDoc
H.assertBool ("attr subst foo") $ not $ B.null $
- snd $ B.breakSubstring "$(foo)" $ toByteString $ resDoc
+ snd $ B.breakSubstring "${foo}" $ toByteString $ resDoc
------------------------------------------------------------------------------
@@ -213,7 +213,7 @@ bindAttrTest = do
H.assertBool ("attr subst " ++ (show str)) $ not $ B.null $
snd $ B.breakSubstring str $ toByteString $ resDoc
H.assertBool ("attr subst bar") $ B.null $
- snd $ B.breakSubstring "$(bar)" $ toByteString $ resDoc
+ snd $ B.breakSubstring "${bar}" $ toByteString $ resDoc
------------------------------------------------------------------------------
View
4 test/templates/attrs.tpl
@@ -1,3 +1,3 @@
<mytag flag="">Empty attribute</mytag>
-<mytag flag="abc\$(foo)">No ident capture</mytag>
-<div id="pre_$(foo)_post"/>
+<mytag flag="abc\${foo}">No ident capture</mytag>
+<div id="pre_${foo}_post"/>
View
2 test/templates/bind-attrs.tpl
@@ -1,2 +1,2 @@
<bind tag="bar">zzzzz</bind>
-<div id="$(bar)"> </div>
+<div id="${bar}"> </div>

0 comments on commit 8340c37

Please sign in to comment.