diff options
author | Jesse Rosenthal <jrosenthal@jhu.edu> | 2018-01-04 09:46:34 -0500 |
---|---|---|
committer | Jesse Rosenthal <jrosenthal@jhu.edu> | 2018-01-04 09:46:34 -0500 |
commit | 7c8a6feaf2d494b9623ef5af9022580a7e4c3c16 (patch) | |
tree | ab3de389dde94c85b6ffc9a3a018cbd3bd72c96a | |
parent | 85f8d9285063767e52266243d2b10af1cbe5f856 (diff) | |
download | pandoc-7c8a6feaf2d494b9623ef5af9022580a7e4c3c16.tar.gz |
Powerpoint writer: remove some code duplication.
-rw-r--r-- | src/Text/Pandoc/Writers/Powerpoint.hs | 13 |
1 files changed, 3 insertions, 10 deletions
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 |