xml-hamlet 0.2.0.3 → 0.3.0
raw patch · 3 files changed
+20/−17 lines, 3 filesdep ~HUnitdep ~parsecdep ~shakespeare
Dependency ranges changed: HUnit, parsec, shakespeare, text, xml-conduit
Files
- Text/Hamlet/XMLParse.hs +4/−6
- test/main.hs +9/−4
- xml-hamlet.cabal +7/−7
Text/Hamlet/XMLParse.hs view
@@ -177,7 +177,7 @@ _ <- char ':' tagAttrib (Just d) tagAttrib cond = do- s <- many1 $ noneOf " \t=\r\n>"+ s <- many1 $ noneOf " \t=\r\n><" v <- (do _ <- char '=' s' <- tagAttribValue NotInQuotesAttr@@ -191,13 +191,11 @@ _ <- char '<' name' <- many $ noneOf " \t\r\n>" let name = if null name' then "div" else name'- xs <- many $ try ((many $ oneOf " \t") >>+ xs <- many $ try ((many $ oneOf " \t\r\n") >> (tagCond <|> tagAttrib Nothing)) _ <- many $ oneOf " \t"- c <- (eol >> return []) <|> (do- _ <- char '>'- c <- content InContent- return c)+ _ <- char '>'+ c <- content InContent let (tn, attr) = tag' $ TagName name : xs return $ LineTag tn attr c
test/main.hs view
@@ -10,7 +10,7 @@ main = hspecX $ describe "xml-hamlet" [ it "handles plain tags" $ [xml| <foo>- <baz+ <baz> |] @?= [ X.NodeElement $ X.Element "foo" [] [ X.NodeElement $ X.Element "baz" [] []@@ -47,7 +47,7 @@ , it "handles attributes" $ [xml| <foo> <bar here=there>- <baz+ <baz> |] @?= [ X.NodeElement $ X.Element "foo" [] [ X.NodeElement $ X.Element "bar" [("here", "there")]@@ -58,7 +58,7 @@ , it "handles attributes" $ [xml| <foo> <bar here=there>- <baz :False:false=false :True:true=#{true}+ <baz :False:false=false :True:true=#{true}> |] @?= [ X.NodeElement $ X.Element "foo" [] [ X.NodeElement $ X.Element "bar" [("here", "there")]@@ -119,12 +119,17 @@ , X.NodeElement $ X.Element "seven" [] [] ] , it "recognizes clark notation" $ [xml|-<{foo}bar {baz}bin="x"+<{foo}bar {baz}bin="x"> |] @?= [X.NodeElement $ X.Element "{foo}bar" [("{baz}bin", "x")] []] , it "recognizes clark with URLs" $ [xml| <{http://www.example.com/foo/bar}baz> |] @?= [X.NodeElement $ X.Element "{http://www.example.com/foo/bar}baz" [] []] , it "allow embedding comments" $[xml|^{comment}|] @?= comment+ , it "multiline tags" $ [xml|+<foo bar=baz+ bin=bin>content+|] @?= [xml|<foo bar=baz bin=bin>content|]+ , it "short circuiting of attributes" $ [xml|<foo :False:x=#{undefined}>|] @?= [xml|<foo>|] ] where bin = "bin"
xml-hamlet.cabal view
@@ -1,5 +1,5 @@ Name: xml-hamlet-Version: 0.2.0.3+Version: 0.3.0 Synopsis: Hamlet-style quasiquoter for XML content Homepage: http://www.yesodweb.com/ License: BSD3@@ -18,8 +18,8 @@ Other-modules: Text.Hamlet.XMLParse Build-depends: base >= 4 && < 5- , shakespeare >= 0.10 && < 0.12- , xml-conduit >= 0.5 && < 0.7+ , shakespeare >= 1.0 && < 1.1+ , xml-conduit >= 0.5 && < 0.8 , text >= 0.10 && < 1.0 , template-haskell , parsec >= 2.0 && < 3.2@@ -32,11 +32,11 @@ type: exitcode-stdio-1.0 ghc-options: -Wall build-depends: hspec- , HUnit >= 1.2 && < 1.3+ , HUnit , base >= 4 && < 5- , shakespeare >= 0.10 && < 0.11+ , shakespeare , xml-conduit- , text >= 0.10 && < 1.0+ , text , template-haskell- , parsec >= 2.0 && < 3.2+ , parsec , xml-hamlet