From 177c5120a5d13c7019d99a3b79d3cc0981a00214 Mon Sep 17 00:00:00 2001 From: Alexander Krotov Date: Fri, 2 Mar 2018 00:56:52 +0300 Subject: Muse reader: do not consume whitespace while looking for closing end tag Fix for a bug caught by round-trip test. --- src/Text/Pandoc/Readers/Muse.hs | 2 +- test/Tests/Readers/Muse.hs | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/Text/Pandoc/Readers/Muse.hs b/src/Text/Pandoc/Readers/Muse.hs index d86c46aca..6183f91cd 100644 --- a/src/Text/Pandoc/Readers/Muse.hs +++ b/src/Text/Pandoc/Readers/Muse.hs @@ -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 diff --git a/test/Tests/Readers/Muse.hs b/test/Tests/Readers/Muse.hs index 1a8378b06..f326b39d4 100644 --- a/test/Tests/Readers/Muse.hs +++ b/test/Tests/Readers/Muse.hs @@ -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 + [ "" + , " - " + , " foo" + , " " + , " bar" -- Do not consume whitespace while looking for arbitraritly indented + , "" + ] =?> + blockQuote (bulletList [ blockQuote $ para "foo" ] <> para "bar") ] ] -- cgit v1.2.3