@@ -76,6 +76,7 @@ import Data.Maybe (maybeToList, fromMaybe)
7676import Text.Pandoc.Highlighting
7777import qualified Data.Text as T
7878import Control.Applicative ((<|>))
79+import Data.Char (isSpace)
7980import Skylighting
8081
8182data WriterEnv = WriterEnv { envMetadata :: Meta
@@ -229,7 +230,6 @@ data Paragraph = Paragraph { paraProps :: ParaProps
229230 , paraElems :: [ParaElem]
230231 } deriving (Show, Eq)
231232
232−
233233data BulletType = Bullet
234234 | AutoNumbering ListAttributes
235235 deriving (Show, Eq)
@@ -853,6 +853,41 @@ replaceAnchor (Run rProps s)
853853 return $ Run rProps' s
854854replaceAnchor pe = return pe
855855
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
862+
863+emptyParagraph :: Paragraph -> Bool
864+emptyParagraph para = all emptyParaElem $ paraElems para
865+
866+
867+emptyShape :: Shape -> Bool
868+emptyShape (TextBox paras) = all emptyParagraph $ paras
869+emptyShape _ = False
870+
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
886+
887+emptySlide :: Slide -> Bool
888+emptySlide (Slide _ layout Nothing) = emptyLayout layout
889+emptySlide _ = False
890+
856891blocksToPresentationSlides :: [Block] -> Pres [Slide]
857892blocksToPresentationSlides blks = do
858893 opts <- asks envOpts
@@ -893,7 +928,8 @@ blocksToPresentationSlides blks = do
893928 return [endNotesSlide]
894929
895930 let slides = metadataslides ++ tocSlides ++ bodyslides ++ endNotesSlides
896− mapM (applyToSlide replaceAnchor) slides
931+ slides' = filter (not . emptySlide) slides
932+ mapM (applyToSlide replaceAnchor) slides'
897933
898934metaToDocProps :: Meta -> DocProps
899935metaToDocProps meta =