diff options
Diffstat (limited to 'src/Text/Pandoc/Writers')
-rw-r--r-- | src/Text/Pandoc/Writers/HTML.hs | 12 | ||||
-rw-r--r-- | src/Text/Pandoc/Writers/LaTeX.hs | 6 |
2 files changed, 14 insertions, 4 deletions
diff --git a/src/Text/Pandoc/Writers/HTML.hs b/src/Text/Pandoc/Writers/HTML.hs index adf59ae4d..5530247a2 100644 --- a/src/Text/Pandoc/Writers/HTML.hs +++ b/src/Text/Pandoc/Writers/HTML.hs @@ -115,7 +115,7 @@ pandocToHtml opts (Pandoc (Meta title' authors' date') blocks) = do date <- if standalone then inlineListToHtml opts date' else return mempty - let slideLevel = getSlideLevel blocks + let slideLevel = maybe (getSlideLevel blocks) id $ writerSlideLevel opts let sects = hierarchicalize $ if writerSlideVariant opts == NoSlides then blocks @@ -252,15 +252,21 @@ elementToHtml slideLevel opts (Sec level num id' title' elements) = do modify $ \st -> st{stSecNum = num} -- update section number -- always use level 1 for slide titles let level' = if slide then 1 else level + let titleSlide = slide && level < slideLevel header' <- blockToHtml opts (Header level' title') - innerContents <- mapM (elementToHtml slideLevel opts) elements + let isSec (Sec _ _ _ _ _) = True + isSec (Blk _) = False + innerContents <- mapM (elementToHtml slideLevel opts) + $ if titleSlide + -- title slides have no content of their own + then filter isSec elements + else elements let header'' = if (writerStrictMarkdown opts || writerSectionDivs opts || writerSlideVariant opts == S5Slides) then header' else header' ! prefixedId opts id' let inNl x = mconcat $ nl opts : intersperse (nl opts) x ++ [nl opts] - let titleSlide = slide && level < slideLevel let classes = ["titleslide" | titleSlide] ++ ["slide" | slide] ++ ["level" ++ show level] let secttag = if writerHtml5 opts diff --git a/src/Text/Pandoc/Writers/LaTeX.hs b/src/Text/Pandoc/Writers/LaTeX.hs index bf1ad91d9..140ef171d 100644 --- a/src/Text/Pandoc/Writers/LaTeX.hs +++ b/src/Text/Pandoc/Writers/LaTeX.hs @@ -201,7 +201,8 @@ inCmd cmd contents = char '\\' <> text cmd <> braces contents toSlides :: [Block] -> State WriterState [Block] toSlides bs = do - let slideLevel = getSlideLevel bs + opts <- gets stOptions + let slideLevel = maybe (getSlideLevel bs) id $ writerSlideLevel opts let bs' = prepSlides slideLevel bs concat `fmap` (mapM (elementToBeamer slideLevel) $ hierarchicalize bs') @@ -214,7 +215,10 @@ elementToBeamer slideLevel (Sec lvl _num _ident tit elts) : tit ++ [RawInline "latex" "}"] ) : bs ++ [RawBlock "latex" "\\end{block}"] | lvl < slideLevel = do + let isSec (Sec _ _ _ _ _) = True + isSec (Blk _) = False bs <- concat `fmap` mapM (elementToBeamer slideLevel) elts + -- (filter isSec elts) return $ (Header lvl tit) : bs | otherwise = do -- lvl == slideLevel -- note: [fragile] is required or verbatim breaks |