Fixed regression in parsing of HTML comments in markdown...
and other non-HTML formats (`Text.Pandoc.Readers.HTML.htmlTag`).
The parser stopped at the first `>` character, even if it wasn't
the end of the comment.
Closes #4019.
commitfb6e5812bce4c71d6ac9a8946f0d69d4c08820de
authorJohn MacFarlane <jgm@berkeley.edu>
dateTue 31 Oct 2017, 21:13 (9 years ago)
parentfd7e3cb
src/Text/Pandoc/Readers/HTML.hs+3−2
@@ -1172,8 +1172,9 @@ htmlTag f = try $ do
11721172 case next of
11731173 TagComment s
11741174 | "<!--" `isPrefixOf` inp -> do
1175− char '<'
1176− manyTill anyChar endAngle
1175+ string "<!--"
1176+ count (length s) anyChar
1177+ string "-->"
11771178 stripComments <- getOption readerStripComments
11781179 if stripComments
11791180 then return (next, "")
test/command/4019.mdnew file+8
@@ -0,0 +1,8 @@
1+```
2+pandoc --wrap=preserve
3+This <!-- x > 0 --> works!
4+This <!-- x > 0 --> fails?
5+^D
6+<p>This <!-- x > 0 --> works!
7+This <!-- x > 0 --> fails?</p>
8+```