@@ -401,10 +401,7 @@ noteSize :: Pixels
401noteSize = 18
401noteSize = 18
403blockToParagraphs :: Block -> Pres [Paragraph]
403blockToParagraphs :: Block -> Pres [Paragraph]
404−blockToParagraphs (Plain ils) = do
404+blockToParagraphs (Plain ils) = blockToParagraphs (Para ils)
405− parElems <- inlinesToParElems ils
406− pProps <- asks envParaProps
407− return [Paragraph pProps parElems]
408blockToParagraphs (Para ils) = do
405blockToParagraphs (Para ils) = do
409 parElems <- inlinesToParElems ils
406 parElems <- inlinesToParElems ils
410 pProps <- asks envParaProps
407 pProps <- asks envParaProps
@@ -519,14 +516,9 @@ withAttr attr (Pic picPr url caption) =
519withAttr _ sp = sp
516withAttr _ sp = sp
521blockToShape :: Block -> Pres Shape
518blockToShape :: Block -> Pres Shape
522−blockToShape (Plain (il:_)) | Image attr ils (url, _) <- il =
519+blockToShape (Plain ils) = blockToShape (Para ils)
523− (withAttr attr . Pic def url) <$> inlinesToParElems ils
524blockToShape (Para (il:_)) | Image attr ils (url, _) <- il =
520blockToShape (Para (il:_)) | Image attr ils (url, _) <- il =
525 (withAttr attr . Pic def url) <$> inlinesToParElems ils
521 (withAttr attr . Pic def url) <$> inlinesToParElems ils
526−blockToShape (Plain (il:_)) | Link _ (il':_) target <- il
527− , Image attr ils (url, _) <- il' =
528− (withAttr attr . Pic def {picPropLink = Just $ ExternalTarget target} url) <$>
529− inlinesToParElems ils
530blockToShape (Para (il:_)) | Link _ (il':_) target <- il
522blockToShape (Para (il:_)) | Link _ (il':_) target <- il
531 , Image attr ils (url, _) <- il' =
523 , Image attr ils (url, _) <- il' =
532 (withAttr attr . Pic def{picPropLink = Just $ ExternalTarget target} url) <$>
524 (withAttr attr . Pic def{picPropLink = Just $ ExternalTarget target} url) <$>
@@ -550,7 +542,6 @@ blockToShape blk = do paras <- blockToParagraphs blk
551combineShapes :: [Shape] -> [Shape]
543combineShapes :: [Shape] -> [Shape]
552combineShapes [] = []
544combineShapes [] = []
553−combineShapes[s] = [s]
554combineShapes (pic@Pic{} : ss) = pic : combineShapes ss
545combineShapes (pic@Pic{} : ss) = pic : combineShapes ss
555combineShapes (TextBox [] : ss) = combineShapes ss
546combineShapes (TextBox [] : ss) = combineShapes ss
556combineShapes (s : TextBox [] : ss) = combineShapes (s : ss)
547combineShapes (s : TextBox [] : ss) = combineShapes (s : ss)
@@ -639,9 +630,9 @@ blocksToSlide' _ (blk : blks) spkNotes
639 , Div (_, clsL, _) blksL : Div (_, clsR, _) blksR : remaining <- divBlks
630 , Div (_, clsL, _) blksL : Div (_, clsR, _) blksR : remaining <- divBlks
640 , "column" `elem` clsL, "column" `elem` clsR = do
631 , "column" `elem` clsL, "column" `elem` clsR = do
641 unless (null blks)
632 unless (null blks)
642− (mapM (addLogMessage . BlockNotRendered) blks >> return ())
633+ (mapM_ (addLogMessage . BlockNotRendered) blks >> return ())
643 unless (null remaining)
634 unless (null remaining)
644− (mapM (addLogMessage . BlockNotRendered) remaining >> return ())
635+ (mapM_ (addLogMessage . BlockNotRendered) remaining >> return ())
645 mbSplitBlksL <- splitBlocks blksL
636 mbSplitBlksL <- splitBlocks blksL
646 mbSplitBlksR <- splitBlocks blksR
637 mbSplitBlksR <- splitBlocks blksR
647 let blksL' = case mbSplitBlksL of
638 let blksL' = case mbSplitBlksL of
@@ -732,15 +723,14 @@ makeEndNotesSlideBlocks = do
732 anchorSet <- M.keysSet <$> gets stAnchorMap
723 anchorSet <- M.keysSet <$> gets stAnchorMap
733 if M.null noteIds
724 if M.null noteIds
734 then return []
725 then return []
735− else do let title = case lookupMeta "notes-title" meta of
726+ else let title = case lookupMeta "notes-title" meta of
736− Just val -> metaValueToInlines val
727+ Just val -> metaValueToInlines val
737− Nothing -> [Str "Notes"]
728+ Nothing -> [Str "Notes"]
738− ident = Shared.uniqueIdent title anchorSet
729+ ident = Shared.uniqueIdent title anchorSet
739− hdr = Header slideLevel (ident, [], []) title
730+ hdr = Header slideLevel (ident, [], []) title
741− concatMap (\(n, bs) -> makeNoteEntry n bs) $
731+ blks = concatMap (\(n, bs) -> makeNoteEntry n bs) $
742 M.toList noteIds
732 M.toList noteIds
743− return $ hdr : blks
733+ in return $ hdr : blks
745getMetaSlide :: Pres (Maybe Slide)
735getMetaSlide :: Pres (Maybe Slide)
746getMetaSlide = do
736getMetaSlide = do
@@ -791,8 +781,7 @@ makeTOCSlide blks = local (\env -> env{envCurSlideId = tocSlideId}) $ do
791 Just val -> metaValueToInlines val
781 Just val -> metaValueToInlines val
792 Nothing -> [Str "Table of Contents"]
782 Nothing -> [Str "Table of Contents"]
793 hdr = Header slideLevel nullAttr tocTitle
783 hdr = Header slideLevel nullAttr tocTitle
794− sld <- blocksToSlide [hdr, contents]
784+ blocksToSlide [hdr, contents]
797combineParaElems' :: Maybe ParaElem -> [ParaElem] -> [ParaElem]
786combineParaElems' :: Maybe ParaElem -> [ParaElem] -> [ParaElem]
798combineParaElems' mbPElem [] = maybeToList mbPElem
787combineParaElems' mbPElem [] = maybeToList mbPElem
@@ -815,15 +804,9 @@ applyToParagraph f para = do
815 return $ para {paraElems = paraElems'}
804 return $ para {paraElems = paraElems'}
817applyToShape :: Monad m => (ParaElem -> m ParaElem) -> Shape -> m Shape
806applyToShape :: Monad m => (ParaElem -> m ParaElem) -> Shape -> m Shape
818−applyToShape f (Pic pPr fp pes) = do
807+applyToShape f (Pic pPr fp pes) = Pic pPr fp <$> mapM f pes
820− return $ Pic pPr fp pes'
821−applyToShape f (GraphicFrame gfx pes) = do
808+applyToShape f (GraphicFrame gfx pes) = GraphicFrame gfx <$> mapM f pes
823− return $ GraphicFrame gfx pes'
824−applyToShape f (TextBox paras) = do
809+applyToShape f (TextBox paras) = TextBox <$> mapM (applyToParagraph f) paras
825− paras' <- mapM (applyToParagraph f) paras
826− return $ TextBox paras'
828applyToLayout :: Monad m => (ParaElem -> m ParaElem) -> Layout -> m Layout
811applyToLayout :: Monad m => (ParaElem -> m ParaElem) -> Layout -> m Layout
829applyToLayout f (MetadataSlide title subtitle authors date) = do
812applyToLayout f (MetadataSlide title subtitle authors date) = do
@@ -832,9 +815,7 @@ applyToLayout f (MetadataSlide title subtitle authors date) = do
832 authors' <- mapM (mapM f) authors
815 authors' <- mapM (mapM f) authors
833 date' <- mapM f date
816 date' <- mapM f date
834 return $ MetadataSlide title' subtitle' authors' date'
817 return $ MetadataSlide title' subtitle' authors' date'
835−applyToLayout f (TitleSlide title) = do
818+applyToLayout f (TitleSlide title) = TitleSlide <$> mapM f title
836− title' <- mapM f title
837− return $ TitleSlide title'
838applyToLayout f (ContentSlide hdr content) = do
819applyToLayout f (ContentSlide hdr content) = do
839 hdr' <- mapM f hdr
820 hdr' <- mapM f hdr
840 content' <- mapM (applyToShape f) content
821 content' <- mapM (applyToShape f) content
@@ -896,10 +877,7 @@ emptyLayout layout = case layout of
896 all emptyShape shapes2
877 all emptyShape shapes2
898emptySlide :: Slide -> Bool
879emptySlide :: Slide -> Bool
899−emptySlide (Slide _ layout notes) =
880+emptySlide (Slide _ layout notes) = (notes == mempty) && (emptyLayout layout)
901− then emptyLayout layout
904blocksToPresentationSlides :: [Block] -> Pres [Slide]
882blocksToPresentationSlides :: [Block] -> Pres [Slide]
905blocksToPresentationSlides blks = do
883blocksToPresentationSlides blks = do