From fa2c008ae5edf36b5345d56e859d0b5cf7a14e69 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Tue, 21 Jul 2015 22:44:18 -0700 Subject: Fix regression: allow HTML comments containing `--`. Technically this isn't allowed in an HTML comment, but we've always allowed it, and so do most other implementations. It is handy if e.g. you want to put command line arguments in HTML comments. --- src/Text/Pandoc/Readers/HTML.hs | 8 ++++---- tests/Tests/Readers/Markdown.hs | 3 +++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/Text/Pandoc/Readers/HTML.hs b/src/Text/Pandoc/Readers/HTML.hs index c43bc5295..fcba16e04 100644 --- a/src/Text/Pandoc/Readers/HTML.hs +++ b/src/Text/Pandoc/Readers/HTML.hs @@ -923,10 +923,6 @@ htmlTag f = try $ do let (next : rest) = canonicalizeTags $ parseTagsOptions parseOptions{ optTagWarning = True } inp guard $ f next - -- we get a TagWarning on things like - -- - -- which should NOT be parsed as an HTML tag, see #2277 - guard $ not $ hasTagWarning rest case next of TagComment s | "") | otherwise -> fail "bogus comment mode, HTML5 parse error" _ -> do + -- we get a TagWarning on things like + -- + -- which should NOT be parsed as an HTML tag, see #2277 + guard $ not $ hasTagWarning rest rendered <- manyTill anyChar (char '>') return (next, rendered ++ ">") diff --git a/tests/Tests/Readers/Markdown.hs b/tests/Tests/Readers/Markdown.hs index 17bfd332e..a5425ffb3 100644 --- a/tests/Tests/Readers/Markdown.hs +++ b/tests/Tests/Readers/Markdown.hs @@ -176,6 +176,9 @@ tests = [ testGroup "inline code" , "invalid tag (issue #1820" =: "" =?> para (text "") + , "technically invalid comment" =: + "" =?> + rawBlock "html" "" ] , "unbalanced brackets" =: "[[[[[[[[[[[[[[[hi" =?> para (text "[[[[[[[[[[[[[[[hi") -- cgit v1.2.3