@@ -80,6 +80,7 @@ data WriterState = WriterState
8080 , stEPUBVersion :: Maybe EPUBVersion -- ^ EPUB version if for epub
8181 , stSlideVariant :: HTMLSlideVariant
8282 , stSlideLevel :: Int -- ^ Slide level
83+ , stInSection :: Bool -- ^ Content is in a section (revealjs)
8384 , stCodeBlockNum :: Int -- ^ Number of code block
8485 }
8586
@@ -90,6 +91,7 @@ defaultWriterState = WriterState {stNotes= [], stMath = False, stQuotes = False,
9091 stEPUBVersion = Nothing,
9192 stSlideVariant = NoSlides,
9293 stSlideLevel = 1,
94+ stInSection = False,
9395 stCodeBlockNum = 0}
9496
9597-- Helpers to render HTML with the appropriate function.
@@ -662,8 +664,6 @@ blockToHtml opts (Div (ident, "section":dclasses, dkvs)
662664 else case splitBy isPause xs of
663665 [] -> ([],[])
664666 (z:zs) -> ([],z ++ concatMap inDiv zs)
665− titleContents <- blockListToHtml opts titleBlocks
666− innerContents <- blockListToHtml opts innerSecs
667667 let classes' = ordNub $
668668 ["title-slide" | titleSlide] ++ ["slide" | slide] ++
669669 ["section" | (slide || writerSectionDivs opts) &&
@@ -674,20 +674,26 @@ blockToHtml opts (Div (ident, "section":dclasses, dkvs)
674674 then H5.section
675675 else H.div
676676 let attr = (ident, classes', dkvs)
677+ titleContents <- blockListToHtml opts titleBlocks
678+ inSection <- gets stInSection
679+ innerContents <- do
680+ modify $ \st -> st{ stInSection = True }
681+ res <- blockListToHtml opts innerSecs
682+ modify $ \st -> st{ stInSection = inSection }
683+ return res
677684 if titleSlide
678685 then do
679686 t <- addAttrs opts attr $
680687 secttag $ nl opts <> header' <> nl opts <> titleContents <> nl opts
688+ -- ensure 2D nesting for revealjs, but only for one level;
689+ -- revealjs doesn't like more than one level of nesting
681690 return $
682− -- ensure 2D nesting for revealjs, but only for one level;
683− -- revealjs doesn't like more than one level of nseting
684− (if slideVariant == RevealJsSlides && not (null innerSecs) &&
685− level == slideLevel - 1
686− then \z -> H5.section (nl opts <> z)
687− else id) $ t <> nl opts <>
688− if null innerSecs
689− then mempty
690− else innerContents <> nl opts
691+ if slideVariant == RevealJsSlides && not inSection &&
692+ not (null innerSecs)
693+ then H5.section (nl opts <> t <> nl opts <> innerContents)
694+ else t <> nl opts <> if null innerSecs
695+ then mempty
696+ else innerContents <> nl opts
691697 else if writerSectionDivs opts || slide ||
692698 (hident /= ident && not (T.null hident || T.null ident)) ||
693699 (hclasses /= dclasses) || (hkvs /= dkvs)