Muse reader: do not reparse blocks inside unclosed block tag

Fixes #4425
This commit is contained in:
Alexander Krotov 2018-03-12 13:38:31 +03:00
parent 15f700d8ed
commit f0a029ac51
2 changed files with 22 additions and 4 deletions

View file

@ -265,10 +265,10 @@ parseBlocksTill :: PandocMonad m
=> MuseParser m a
-> MuseParser m (F Blocks)
parseBlocksTill end =
try parseEnd <|>
try blockStart <|>
try listStart <|>
try paraStart
try (parseEnd <|>
blockStart <|>
listStart <|>
paraStart)
where
parseEnd = mempty <$ end
blockStart = do first <- blockElements

View file

@ -1224,5 +1224,23 @@ tests =
, "</quote>"
] =?>
blockQuote (bulletList [ blockQuote $ para "foo" ] <> para "bar")
, "Unclosed quote tag" =:
T.unlines
[ "<quote>"
, "<verse>"
, "</quote>"
, "</verse>"
] =?>
para "<quote>" <> lineBlock [ "</quote>" ]
, "Unclosed quote tag inside list" =:
T.unlines
[ " - <quote>"
, " <verse>"
, " </quote>"
, " </verse>"
] =?>
bulletList [ para "<quote>" <> lineBlock [ "</quote>" ] ]
]
]