summaryrefslogtreecommitdiff
path: root/Pancake/Rendering.hs
diff options
context:
space:
mode:
authordefanor <defanor@uberspace.net>2017-11-08 13:21:48 +0300
committerdefanor <defanor@uberspace.net>2017-11-08 13:21:48 +0300
commit1a1307e0c7691a7e155e67179d196793f5059dc0 (patch)
treedc4300018047fb68a76100a43a89aff76a1aa41e /Pancake/Rendering.hs
parent6ca97c245713ea6ba83a3cd1d3c9873bac6bcd99 (diff)
Adjust spacing between blocks
Diffstat (limited to 'Pancake/Rendering.hs')
-rw-r--r--Pancake/Rendering.hs10
1 files changed, 7 insertions, 3 deletions
diff --git a/Pancake/Rendering.hs b/Pancake/Rendering.hs
index 0794616..b1b5350 100644
--- a/Pancake/Rendering.hs
+++ b/Pancake/Rendering.hs
@@ -316,7 +316,7 @@ readInlines i = pure . concat <$> mapM readInline i
-- | Renders a block element.
renderBlock :: P.Block -> Renderer ()
renderBlock (P.Plain i) = indented =<< readInlines i
-renderBlock (P.Para i) = (indented =<< readInlines i) >> storeLines [[""]]
+renderBlock (P.Para i) = indented =<< readInlines i
renderBlock (P.LineBlock i) =
indented =<< concat <$> mapM (mapM readInline) i
renderBlock (P.CodeBlock attr s) = do
@@ -393,9 +393,13 @@ renderBlock (P.Div attr b) = do
renderBlocks b
renderBlock P.Null = pure ()
+-- | Renders a block element followed by an empy line.
+renderBlockLn :: P.Block -> Renderer ()
+renderBlockLn b = renderBlock b >> storeLines [[]]
+
-- | Renders multiple block elements.
renderBlocks :: [P.Block] -> Renderer ()
-renderBlocks b = withIndent $ mapM_ renderBlock b
+renderBlocks b = withIndent $ mapM_ renderBlockLn b
-- | Renders a document.
renderDoc :: Int
@@ -405,4 +409,4 @@ renderDoc :: Int
-> [RendererOutput]
-- ^ Rendered document.
renderDoc cols (P.Pandoc _ blocks) =
- runRenderer cols 0 1 $ mapM_ renderBlock blocks
+ runRenderer cols 0 1 $ mapM_ renderBlockLn blocks