From 7c8a6feaf2d494b9623ef5af9022580a7e4c3c16 Mon Sep 17 00:00:00 2001 From: Jesse Rosenthal Date: Thu, 4 Jan 2018 09:46:34 -0500 Subject: Powerpoint writer: remove some code duplication. --- src/Text/Pandoc/Writers/Powerpoint.hs | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) (limited to 'src/Text/Pandoc/Writers') diff --git a/src/Text/Pandoc/Writers/Powerpoint.hs b/src/Text/Pandoc/Writers/Powerpoint.hs index c53f2f66c..9466b1570 100644 --- a/src/Text/Pandoc/Writers/Powerpoint.hs +++ b/src/Text/Pandoc/Writers/Powerpoint.hs @@ -530,6 +530,9 @@ splitBlocks' cur acc (h@(Header n _ _) : blks) = do LT -> splitBlocks' [] (acc ++ (if null cur then [] else [cur]) ++ [[h]]) blks EQ -> splitBlocks' [h] (acc ++ (if null cur then [] else [cur])) blks GT -> splitBlocks' (cur ++ [h]) acc blks +-- `blockToParagraphs` treats Plain and Para the same, so we can save +-- some code duplication by treating them the same here. +splitBlocks' cur acc ((Plain ils) : blks) = splitBlocks' cur acc ((Para ils) : blks) splitBlocks' cur acc ((Para (il:ils)) : blks) | isImage il = do slideLevel <- asks envSlideLevel case cur of @@ -540,16 +543,6 @@ splitBlocks' cur acc ((Para (il:ils)) : blks) | isImage il = do _ -> splitBlocks' [] (acc ++ (if null cur then [] else [cur]) ++ [[Para [il]]]) (if null ils then blks else (Para ils) : blks) -splitBlocks' cur acc ((Plain (il:ils)) : blks) | isImage il = do - slideLevel <- asks envSlideLevel - case cur of - (Header n _ _) : [] | n == slideLevel -> - splitBlocks' [] - (acc ++ [cur ++ [Plain [il]]]) - (if null ils then blks else (Plain ils) : blks) - _ -> splitBlocks' [] - (acc ++ (if null cur then [] else [cur]) ++ [[Plain [il]]]) - (if null ils then blks else (Plain ils) : blks) splitBlocks' cur acc (tbl@(Table _ _ _ _ _) : blks) = do slideLevel <- asks envSlideLevel case cur of -- cgit v1.2.3