summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Krotov <ilabdsf@gmail.com>2018-03-02 00:56:52 +0300
committerAlexander Krotov <ilabdsf@gmail.com>2018-03-02 01:01:50 +0300
commit177c5120a5d13c7019d99a3b79d3cc0981a00214 (patch)
treedc298ab7d304a60e8c8cbbdef27425324ec6a17a
parente881214bf9a3cc990110ae3a23aec1d6b4076f66 (diff)
Muse reader: do not consume whitespace while looking for closing end tag
Fix for a bug caught by round-trip test.
-rw-r--r--src/Text/Pandoc/Readers/Muse.hs2
-rw-r--r--test/Tests/Readers/Muse.hs11
2 files changed, 12 insertions, 1 deletions
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
+ [ "<quote>"
+ , " - <quote>"
+ , " foo"
+ , " </quote>"
+ , " bar" -- Do not consume whitespace while looking for arbitraritly indented </quote>
+ , "</quote>"
+ ] =?>
+ blockQuote (bulletList [ blockQuote $ para "foo" ] <> para "bar")
]
]