git.iko.soy/typeable/pandoc
on master help sign in
Fix revealjs slide structure regression with certain slide levels.

Partially addresses #6030.

commit0dff9b3cd2cd222e5eeebd880f38b38ad5ee58f0 authorJohn MacFarlane <jgm@berkeley.edu> dateSun 5 Jan 2020, 09:35 (7 years ago) parentb96febd
2 files changed+43−6
src/Text/Pandoc/Writers/HTML.hs+8−6 test/command/6030.md+35
src/Text/Pandoc/Writers/HTML.hs+8−6
@@ -676,13 +676,15 @@ blockToHtml opts (Div (ident, "section":dclasses, dkvs)
676676 let attr = (ident, classes', dkvs)
677677 if titleSlide
678678 then do
679− t <- addAttrs opts attr $ secttag $ header' <> titleContents
679+ t <- addAttrs opts attr $
680+ secttag $ nl opts <> header' <> nl opts <> titleContents <> nl opts
680681 return $
681− (if slideVariant == RevealJsSlides && not (null innerSecs)
682− -- revealjs doesn't like more than one level of section nesting:
683− {- REMOVED && isNothing mbparentlevel -}
684− then H5.section
685− else id) $ nl opts <> t <> nl opts <>
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 <>
686688 if null innerSecs
687689 then mempty
688690 else innerContents <> nl opts
test/command/6030.mdnew file+35
@@ -0,0 +1,35 @@
1+```
2+% pandoc -t revealjs --slide-level=3
3+# One
4+
5+One
6+
7+## Two
8+
9+Two
10+
11+### Three
12+
13+Three
14+
15+#### Four
16+
17+Four
18+^D
19+<section id="one" class="title-slide slide level1">
20+<h1>One</h1>
21+<p>One</p>
22+</section>
23+<section>
24+<section id="two" class="title-slide slide level2">
25+<h2>Two</h2>
26+<p>Two</p>
27+</section>
28+<section id="three" class="slide level3">
29+<h3>Three</h3>
30+<p>Three</p>
31+<h4 id="four">Four</h4>
32+<p>Four</p>
33+</section>
34+</section>
35+```