@@ -76,6 +76,7 @@ import Data.Maybe (maybeToList, fromMaybe)
76import Text.Pandoc.Highlighting
76import Text.Pandoc.Highlighting
77import qualified Data.Text as T
77import qualified Data.Text as T
78import Control.Applicative ((<|>))
78import Control.Applicative ((<|>))
79+import Data.Char (isSpace)
79import Skylighting
80import Skylighting
81data WriterEnv = WriterEnv { envMetadata :: Meta
82data WriterEnv = WriterEnv { envMetadata :: Meta
@@ -229,7 +230,6 @@ data Paragraph = Paragraph { paraProps :: ParaProps
229 , paraElems :: [ParaElem]
230 , paraElems :: [ParaElem]
230 } deriving (Show, Eq)
231 } deriving (Show, Eq)
233data BulletType = Bullet
233data BulletType = Bullet
234 | AutoNumbering ListAttributes
234 | AutoNumbering ListAttributes
235 deriving (Show, Eq)
235 deriving (Show, Eq)
@@ -853,6 +853,41 @@ replaceAnchor (Run rProps s)
853 return $ Run rProps' s
853 return $ Run rProps' s
854replaceAnchor pe = return pe
854replaceAnchor pe = return pe
856+emptyParaElem :: ParaElem -> Bool
857+emptyParaElem (Run _ s) =
858+ null $ dropWhile isSpace $ reverse $ dropWhile isSpace $ reverse s
859+emptyParaElem (MathElem _ ts) =
860+ null $ dropWhile isSpace $ reverse $ dropWhile isSpace $ reverse $ unTeXString ts
861+emptyParaElem _ = False
863+emptyParagraph :: Paragraph -> Bool
864+emptyParagraph para = all emptyParaElem $ paraElems para
867+emptyShape :: Shape -> Bool
868+emptyShape (TextBox paras) = all emptyParagraph $ paras
871+emptyLayout :: Layout -> Bool
872+emptyLayout layout = case layout of
873+ MetadataSlide title subtitle authors date ->
874+ all emptyParaElem title &&
875+ all emptyParaElem subtitle &&
876+ all (all emptyParaElem) authors &&
877+ all emptyParaElem date
878+ TitleSlide hdr -> all emptyParaElem hdr
879+ ContentSlide hdr shapes ->
880+ all emptyParaElem hdr &&
881+ all emptyShape shapes
882+ TwoColumnSlide hdr shapes1 shapes2 ->
883+ all emptyParaElem hdr &&
884+ all emptyShape shapes1 &&
885+ all emptyShape shapes2
887+emptySlide :: Slide -> Bool
888+emptySlide (Slide _ layout Nothing) = emptyLayout layout
856blocksToPresentationSlides :: [Block] -> Pres [Slide]
891blocksToPresentationSlides :: [Block] -> Pres [Slide]
857blocksToPresentationSlides blks = do
892blocksToPresentationSlides blks = do
858 opts <- asks envOpts
893 opts <- asks envOpts
@@ -893,7 +928,8 @@ blocksToPresentationSlides blks = do
893 return [endNotesSlide]
928 return [endNotesSlide]
895 let slides = metadataslides ++ tocSlides ++ bodyslides ++ endNotesSlides
930 let slides = metadataslides ++ tocSlides ++ bodyslides ++ endNotesSlides
931+ slides' = filter (not . emptySlide) slides
896− mapM (applyToSlide replaceAnchor) slides
932+ mapM (applyToSlide replaceAnchor) slides'
898metaToDocProps :: Meta -> DocProps
934metaToDocProps :: Meta -> DocProps
899metaToDocProps meta =
935metaToDocProps meta =