aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Shared.hs
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2014-07-07 15:39:59 -0600
committerJohn MacFarlane <jgm@berkeley.edu>2014-07-07 15:53:59 -0600
commit8c7abf173a589ba12ddac110cdd5cb3e8ebc1dcc (patch)
tree7c16ac778d35d325c22d2144a4cb0026ec740326 /src/Text/Pandoc/Shared.hs
parentcbeb93155493a54d9de6578911ca1ffd3d97d926 (diff)
downloadpandoc-8c7abf173a589ba12ddac110cdd5cb3e8ebc1dcc.tar.gz
normalize: consolidate adjacent RawBlocks when possible.
Diffstat (limited to 'src/Text/Pandoc/Shared.hs')
-rw-r--r--src/Text/Pandoc/Shared.hs5
1 files changed, 5 insertions, 0 deletions
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