tag-stream 0.2.0 → 0.2.1
raw patch · 3 files changed
+12/−18 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- Text/HTML/TagStream/Parser.hs +2/−11
- tag-stream.cabal +1/−1
- tests/Tests.hs +9/−6
Text/HTML/TagStream/Parser.hs view
@@ -3,7 +3,6 @@ import Control.Applicative import Data.ByteString (ByteString)-import qualified Data.ByteString.Char8 as S import Data.Attoparsec.Char8 import Blaze.ByteString.Builder (toByteString) import Text.HTML.TagStream.Types@@ -127,16 +126,8 @@ <|> (:[]) . Incomplete . append script <$> takeByteString where script = toByteString $ showToken id t- surround q s = S.concat [S.singleton q, s, S.singleton q]- loop acc = do- s <- takeTill (in3 ('<','\'','"'))- let acc' = if S.null s then acc else Text s:acc- mq <- maybeP (satisfy (in2 ('"','\'')))- case mq of- Just q -> Text . surround q <$> quoted q >>=- loop . (:acc')- Nothing -> (:acc') <$> scriptEnd-+ loop acc = (:acc) <$> scriptEnd+ <|> (text >>= loop . (:acc)) scriptEnd = string "</script>" *> return (TagClose "script") html :: Parser [Token]
tag-stream.cabal view
@@ -1,5 +1,5 @@ Name: tag-stream-Version: 0.2.0+Version: 0.2.1 Synopsis: streamlined html tag parser Description: Tag-stream is a library for parsing HTML//XML to a token stream.
tests/Tests.hs view
@@ -103,8 +103,8 @@ , ( "<>" , [TagOpen "" [] False] )- , ( "<a\ttitle\n=\r\"foo\nbar\" alt=\n/\r\t>"- , [TagOpen "a" [("title", "foo\nbar"), ("alt", "/")] False]+ , ( "<a\ttitle\n=\r\"foo bar\" alt=\n/\r\t>"+ , [TagOpen "a" [("title", "foo bar"), ("alt", "/")] False] ) -- }}} -- comment tag {{{@@ -141,11 +141,14 @@ , ( "<script></script>" , [TagOpen "script" [] False, TagClose "script"] )- , ( "<script>var x=\"</script>\";"- , [Incomplete "<script>var x=\"</script>\";"]+ , ( "<script>var x=\"</script>"+ , [TagOpen "script" [] False, Text "var x=\"", TagClose "script"] )- , ( "<script>var x=\"</script>\";</script>"- , [TagOpen "script" [] False, Text "var x=\"</script>\";", TagClose "script"]+ --, ( "<script>var x=\"</script>\";</script>"+ -- , [TagOpen "script" [] False, Text "var x=\"</script>\";", TagClose "script"]+ -- )+ , ( "<script>// '\r\n</script>"+ , [TagOpen "script" [] False, Text "// '\r\n", TagClose "script"] ) -- }}} ]