git.iko.soy/typeable/pandoc
on master help sign in
Muse reader: do not consume whitespace while looking for closing end tag
177c512Alexander Krotov
src/Text/Pandoc/Readers/Muse.hs+1−1
@@ -171,7 +171,7 @@ parseHtmlContent tag = try $ do
171 many spaceChar
171 many spaceChar
172 (TagOpen _ attr, _) <- htmlTag (~== TagOpen tag [])
172 (TagOpen _ attr, _) <- htmlTag (~== TagOpen tag [])
173 manyTill spaceChar eol
173 manyTill spaceChar eol
174− content <- parseBlocksTill (manyTill spaceChar endtag)
174+ content <- parseBlocksTill (try $ manyTill spaceChar endtag)
175 manyTill spaceChar eol -- closing tag must be followed by optional whitespace and newline
175 manyTill spaceChar eol -- closing tag must be followed by optional whitespace and newline
176 return (htmlAttrToPandoc attr, content)
176 return (htmlAttrToPandoc attr, content)
177 where
177 where
test/Tests/Readers/Muse.hs+11
@@ -1208,5 +1208,16 @@ tests =
1208 , para "Second"
1208 , para "Second"
1209 , para "Third"
1209 , para "Third"
1210 ])
1210 ])
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")
1211 ]
1222 ]
1212 ]
1223 ]