git.iko.soy/typeable/pandoc
on master help sign in
Powerpoint writer: Clean up adding metadata slide

We want to count the slide numbers correctly if it's in there.

commit0b66b5652393673fe0b49581e7afdd822020071c authorJesse Rosenthal <jrosenthal@jhu.edu> dateFri 12 Jan 2018, 09:24 (9 years ago) parent2afca42
1 file changed+8−6
src/Text/Pandoc/Writers/Powerpoint.hs+8−6
src/Text/Pandoc/Writers/Powerpoint.hs+8−6
@@ -679,18 +679,20 @@ getMetaSlide = do
679679
680680blocksToPresentation :: PandocMonad m => [Block] -> P m Presentation
681681blocksToPresentation blks = do
682+ metadataslide <- getMetaSlide
683+ let bodyStartNum = case metadataslide of
684+ Just _ -> 2
685+ Nothing -> 1
682686 blksLst <- splitBlocks blks
683687 slides <- mapM
684688 (\(bs, n) -> local (\st -> st{envCurSlideId = n}) (blocksToSlide bs))
685− (zip blksLst [1..])
689+ (zip blksLst [bodyStartNum..])
686690 let noteSlidesNum = length blksLst + 1
687691 noteSlides <- local (\st -> st {envCurSlideId = noteSlidesNum}) makeNotesSlides
688− let slides' = slides ++ noteSlides
689− metadataslide <- getMetaSlide
690692 presSize <- asks envPresentationSize
691− return $ case metadataslide of
692− Just metadataslide' -> Presentation presSize $ metadataslide' : slides'
693− Nothing -> Presentation presSize slides'
693+ return $
694+ Presentation presSize $
695+ (maybeToList metadataslide) ++ slides ++ noteSlides
694696
695697--------------------------------------------------------------------
696698