Skip to content

Commit

Permalink
Fixed issue 13, and added test case to detect the problem.
Browse files Browse the repository at this point in the history
  • Loading branch information
mightybyte committed Dec 6, 2011
1 parent 9a69bc7 commit 7f4e7be
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/Text/Templating/Heist/Internal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,8 @@ parseAtt bs = do
return $ T.concat chunks
where
cvt (Literal x) = return x
cvt (Ident x) = getAttributeSplice x
cvt (Ident x) =
localParamNode (const $ X.Element x [] []) $ getAttributeSplice x


------------------------------------------------------------------------------
Expand Down
9 changes: 8 additions & 1 deletion test/suite/Text/Templating/Heist/Tests.hs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ tests = [ testProperty "heist/simpleBind" simpleBindTest
, testCase "heist/apply" applyTest
, testCase "heist/ignore" ignoreTest
, testCase "heist/lookupTemplateContext" lookupTemplateTest
, testCase "heist/attrSpliceContext" attrSpliceContext
]


Expand Down Expand Up @@ -137,7 +138,7 @@ loadTest = do
ets <- loadT "templates"
either (error "Error loading templates")
(\ts -> do let tm = _templateMap ts
H.assertBool "loadTest size" $ Map.size tm == 21
H.assertBool "loadTest size" $ Map.size tm == 23
) ets


Expand Down Expand Up @@ -268,6 +269,12 @@ bindParam :: H.Assertion
bindParam = renderTest "bind_param" "<li>Hi there world</li>"


------------------------------------------------------------------------------
-- | Handling of <content> and bound parameters in a bonud tag.
attrSpliceContext :: H.Assertion
attrSpliceContext = renderTest "attrsubtest2" "<a href='asdf'>link</a>"


------------------------------------------------------------------------------
-- | Markdown test on supplied text
markdownTextTest :: H.Assertion
Expand Down
1 change: 1 addition & 0 deletions test/templates/attrsubtest1.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<content />
1 change: 1 addition & 0 deletions test/templates/attrsubtest2.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<bind tag="randName284">asdf</bind><apply template="attrsubtest1"><a href="${randName284}">link</a></apply>

0 comments on commit 7f4e7be

Please sign in to comment.