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:
parent
e881214bf9
commit
177c5120a5
2 changed files with 12 additions and 1 deletions
|
@ -171,7 +171,7 @@ parseHtmlContent tag = try $ do
|
||||||
many spaceChar
|
many spaceChar
|
||||||
(TagOpen _ attr, _) <- htmlTag (~== TagOpen tag [])
|
(TagOpen _ attr, _) <- htmlTag (~== TagOpen tag [])
|
||||||
manyTill spaceChar eol
|
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
|
manyTill spaceChar eol -- closing tag must be followed by optional whitespace and newline
|
||||||
return (htmlAttrToPandoc attr, content)
|
return (htmlAttrToPandoc attr, content)
|
||||||
where
|
where
|
||||||
|
|
|
@ -1208,5 +1208,16 @@ tests =
|
||||||
, para "Second"
|
, para "Second"
|
||||||
, para "Third"
|
, 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")
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
|
|
Loading…
Reference in a new issue