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.
This commit is contained in:
John MacFarlane 2017-10-31 21:13:15 -07:00
parent fd7e3cb18f
commit fb6e5812bc
2 changed files with 11 additions and 2 deletions

View file

@ -1172,8 +1172,9 @@ htmlTag f = try $ do
case next of
TagComment s
| "<!--" `isPrefixOf` inp -> do
char '<'
manyTill anyChar endAngle
string "<!--"
count (length s) anyChar
string "-->"
stripComments <- getOption readerStripComments
if stripComments
then return (next, "")

8
test/command/4019.md Normal file
View file

@ -0,0 +1,8 @@
```
pandoc --wrap=preserve
This <!-- x > 0 --> works!
This <!-- x > 0 --> fails?
^D
<p>This <!-- x > 0 --> works!
This <!-- x > 0 --> fails?</p>
```