Muse reader: do not consume whitespace while looking for closing end tag

Fix for a bug caught by round-trip test.
This commit is contained in:
Alexander Krotov 2018-03-02 00:56:52 +03:00
parent e881214bf9
commit 177c5120a5
2 changed files with 12 additions and 1 deletions

View file

@ -171,7 +171,7 @@ parseHtmlContent tag = try $ do
many spaceChar
(TagOpen _ attr, _) <- htmlTag (~== TagOpen tag [])
manyTill spaceChar eol
content <- parseBlocksTill (manyTill spaceChar endtag)
content <- parseBlocksTill (try $ manyTill spaceChar endtag)
manyTill spaceChar eol -- closing tag must be followed by optional whitespace and newline
return (htmlAttrToPandoc attr, content)
where

View file

@ -1208,5 +1208,16 @@ tests =
, para "Second"
, para "Third"
])
-- Regression test for a bug caught by round-trip test
, "Do not consume whitespace while looking for end tag" =:
T.unlines
[ "<quote>"
, " - <quote>"
, " foo"
, " </quote>"
, " bar" -- Do not consume whitespace while looking for arbitraritly indented </quote>
, "</quote>"
] =?>
blockQuote (bulletList [ blockQuote $ para "foo" ] <> para "bar")
]
]