From 8c7abf173a589ba12ddac110cdd5cb3e8ebc1dcc Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Mon, 7 Jul 2014 15:39:59 -0600 Subject: normalize: consolidate adjacent RawBlocks when possible. --- src/Text/Pandoc/Shared.hs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/Text/Pandoc/Shared.hs') diff --git a/src/Text/Pandoc/Shared.hs b/src/Text/Pandoc/Shared.hs index 4a536330d..dacd4e104 100644 --- a/src/Text/Pandoc/Shared.hs +++ b/src/Text/Pandoc/Shared.hs @@ -379,6 +379,11 @@ normalizeBlocks (DefinitionList items : xs) = DefinitionList (map go items) : normalizeBlocks xs where go (ils, bs) = (normalizeInlines ils, map normalizeBlocks bs) normalizeBlocks (RawBlock _ "" : xs) = normalizeBlocks xs +normalizeBlocks (RawBlock f x : xs) = + case normalizeBlocks xs of + (RawBlock f' x' : rest) | f' == f -> + RawBlock f (x ++ ('\n':x')) : rest + rest -> RawBlock f x : rest normalizeBlocks (Para ils : xs) = case normalizeInlines ils of [] -> normalizeBlocks xs -- cgit v1.2.3