From 0ebe65e651766a2b3d006d3dee4afdfd43a386d5 Mon Sep 17 00:00:00 2001 From: Emily Bourke Date: Wed, 8 Sep 2021 14:05:22 +0100 Subject: pptx: Fix logic for choosing Comparison layout There was a mistake in the logic used to choose between the Comparison and Two Content layouts: if one column contained only non-text (an image or a table) and the other contained only text, the Comparison layout was chosen instead of the desired Two Content layout. This commit fixes that logic: > If either column contains text followed by non-text, use Comparison. Otherwise, use Two Content. It also adds a test asserting this behaviour. --- src/Text/Pandoc/Writers/Powerpoint/Presentation.hs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/Text/Pandoc/Writers/Powerpoint/Presentation.hs b/src/Text/Pandoc/Writers/Powerpoint/Presentation.hs index 10060d975..015e2cbdd 100644 --- a/src/Text/Pandoc/Writers/Powerpoint/Presentation.hs +++ b/src/Text/Pandoc/Writers/Powerpoint/Presentation.hs @@ -696,10 +696,11 @@ bodyBlocksToSlide _ (blk : blks) spkNotes sldId (ComparisonSlide [] (shapesL1, shapesL2) (shapesR1, shapesR2)) spkNotes - case (break notText blksL, break notText blksR) of - ((_, []), (_, [])) -> mkTwoColumn blksL blksR - (([], _), ([], _)) -> mkTwoColumn blksL blksR - ((blksL1, blksL2), (blksR1, blksR2)) -> mkComparison blksL1 blksL2 blksR1 blksR2 + let (blksL1, blksL2) = break notText blksL + (blksR1, blksR2) = break notText blksR + if (any null [blksL1, blksL2]) && (any null [blksR1, blksR2]) + then mkTwoColumn blksL blksR + else mkComparison blksL1 blksL2 blksR1 blksR2 bodyBlocksToSlide _ (blk : blks) spkNotes = do sldId <- asks envCurSlideId inNoteSlide <- asks envInNoteSlide -- cgit v1.2.3