git.iko.soy/typeable/pandoc
on master help sign in
Muse reader: do not consume whitespace while looking for closing end tag

Fix for a bug caught by round-trip test.

commit177c5120a5d13c7019d99a3b79d3cc0981a00214 authorAlexander Krotov <ilabdsf@gmail.com> dateFri 2 Mar 2018, 00:56 (9 years ago) parente881214
2 files changed+12−1
src/Text/Pandoc/Readers/Muse.hs+1−1 test/Tests/Readers/Muse.hs+11
src/Text/Pandoc/Readers/Muse.hs+1−1
@@ -171,7 +171,7 @@ parseHtmlContent tag = try $ do
171171 many spaceChar
172172 (TagOpen _ attr, _) <- htmlTag (~== TagOpen tag [])
173173 manyTill spaceChar eol
174− content <- parseBlocksTill (manyTill spaceChar endtag)
174+ content <- parseBlocksTill (try $ manyTill spaceChar endtag)
175175 manyTill spaceChar eol -- closing tag must be followed by optional whitespace and newline
176176 return (htmlAttrToPandoc attr, content)
177177 where
test/Tests/Readers/Muse.hs+11
@@ -1208,5 +1208,16 @@ tests =
12081208 , para "Second"
12091209 , para "Third"
12101210 ])
1211+ -- Regression test for a bug caught by round-trip test
1212+ , "Do not consume whitespace while looking for end tag" =:
1213+ T.unlines
1214+ [ "<quote>"
1215+ , " - <quote>"
1216+ , " foo"
1217+ , " </quote>"
1218+ , " bar" -- Do not consume whitespace while looking for arbitraritly indented </quote>
1219+ , "</quote>"
1220+ ] =?>
1221+ blockQuote (bulletList [ blockQuote $ para "foo" ] <> para "bar")
12111222 ]
12121223 ]