From 0b66b5652393673fe0b49581e7afdd822020071c Mon Sep 17 00:00:00 2001 From: Jesse Rosenthal Date: Fri, 12 Jan 2018 09:24:15 -0500 Subject: Powerpoint writer: Clean up adding metadata slide We want to count the slide numbers correctly if it's in there. --- src/Text/Pandoc/Writers/Powerpoint.hs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src/Text/Pandoc') diff --git a/src/Text/Pandoc/Writers/Powerpoint.hs b/src/Text/Pandoc/Writers/Powerpoint.hs index 990d90433..5a1d089a9 100644 --- a/src/Text/Pandoc/Writers/Powerpoint.hs +++ b/src/Text/Pandoc/Writers/Powerpoint.hs @@ -679,18 +679,20 @@ getMetaSlide = do blocksToPresentation :: PandocMonad m => [Block] -> P m Presentation blocksToPresentation blks = do + metadataslide <- getMetaSlide + let bodyStartNum = case metadataslide of + Just _ -> 2 + Nothing -> 1 blksLst <- splitBlocks blks slides <- mapM (\(bs, n) -> local (\st -> st{envCurSlideId = n}) (blocksToSlide bs)) - (zip blksLst [1..]) + (zip blksLst [bodyStartNum..]) let noteSlidesNum = length blksLst + 1 noteSlides <- local (\st -> st {envCurSlideId = noteSlidesNum}) makeNotesSlides - let slides' = slides ++ noteSlides - metadataslide <- getMetaSlide presSize <- asks envPresentationSize - return $ case metadataslide of - Just metadataslide' -> Presentation presSize $ metadataslide' : slides' - Nothing -> Presentation presSize slides' + return $ + Presentation presSize $ + (maybeToList metadataslide) ++ slides ++ noteSlides -------------------------------------------------------------------- -- cgit v1.2.3