diff options
-rw-r--r-- | src/Text/Pandoc/Writers/RST.hs | 13 | ||||
-rw-r--r-- | test/Tests/Writers/RST.hs | 10 |
2 files changed, 22 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Writers/RST.hs b/src/Text/Pandoc/Writers/RST.hs index 2b28dccf0..694d623a6 100644 --- a/src/Text/Pandoc/Writers/RST.hs +++ b/src/Text/Pandoc/Writers/RST.hs @@ -353,9 +353,20 @@ blockListToRST' :: PandocMonad m -> [Block] -- ^ List of block elements -> RST m Doc blockListToRST' topLevel blocks = do + -- insert comment between list and quoted blocks, see #4248 + let fixBlocks (b1:b2@(BlockQuote _):bs) + | isList b1 = b1 : commentSep : b2 : fixBlocks bs + where + isList (BulletList _) = True + isList (OrderedList _ _) = True + isList (DefinitionList _) = True + isList _ = False + commentSep = RawBlock "rst" "" + fixBlocks (b:bs) = b : fixBlocks bs + fixBlocks [] = [] tl <- gets stTopLevel modify (\s->s{stTopLevel=topLevel, stLastNested=False}) - res <- vcat `fmap` mapM blockToRST' blocks + res <- vcat `fmap` mapM blockToRST' (fixBlocks blocks) modify (\s->s{stTopLevel=tl}) return res diff --git a/test/Tests/Writers/RST.hs b/test/Tests/Writers/RST.hs index 13944ed34..4c0a926bb 100644 --- a/test/Tests/Writers/RST.hs +++ b/test/Tests/Writers/RST.hs @@ -40,6 +40,16 @@ tests = [ testGroup "rubrics" , " :name: foo" , " :class: baz"] ] + , testGroup "ligatures" -- handling specific sequences of blocks + [ "a list is closed by a comment before a quote" =: -- issue 4248 + bulletList [plain "bulleted"] <> blockQuote (plain "quoted") =?> + unlines + [ "- bulleted" + , "" + , ".." + , "" + , " quoted"] + ] , testGroup "headings" [ "normal heading" =: header 1 (text "foo") =?> |