From 1a1307e0c7691a7e155e67179d196793f5059dc0 Mon Sep 17 00:00:00 2001 From: defanor Date: Wed, 8 Nov 2017 13:21:48 +0300 Subject: Adjust spacing between blocks --- Pancake/Rendering.hs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'Pancake/Rendering.hs') 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 -- cgit v1.2.3