Skip to content

Commit

Permalink
Script tags can contain less-than symbol
Browse files Browse the repository at this point in the history
  • Loading branch information
emhoracek committed Oct 18, 2018
1 parent 92f68f4 commit 3e1bd12
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion html-conduit/src/Text/HTML/TagStream.hs
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ tillScriptEnd open =
chunk <- takeTill (== '<')
let acc' = acc <> B.fromText chunk
finish = pure [open, Text $ L.toStrict $ B.toLazyText acc', TagClose "script"]
hasContent = (string "/script>" *> finish) <|> loop acc'
hasContent = (string "/script>" *> finish) <|> loop (acc' <> "<")
(char '<' *> hasContent) <|> finish

tokens :: Parser [Token]
Expand Down
4 changes: 2 additions & 2 deletions html-conduit/test/main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,9 @@ main = hspec $ do

describe "script tags" $ do
it "ignores funny characters" $
let html = "<script>hello > world</script>"
let html = "<script>hello <> world</script>"
doc = X.Document (X.Prologue [] Nothing []) root []
root = X.Element "script" Map.empty [X.NodeContent "hello > world"]
root = X.Element "script" Map.empty [X.NodeContent "hello <> world"]
in H.parseLBS html @?= doc

{-
Expand Down

0 comments on commit 3e1bd12

Please sign in to comment.