From c335b6cbd8e73537f6482ffc127bb428f586602e Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Sun, 2 Oct 2011 23:19:03 -0700 Subject: HTML slides: only add id to div/section if --section-divs selected. --- src/Text/Pandoc/Writers/HTML.hs | 11 +++++------ tests/s5.basic.html | 4 ++-- tests/s5.fancy.html | 4 ++-- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/Text/Pandoc/Writers/HTML.hs b/src/Text/Pandoc/Writers/HTML.hs index 6bc911fbd..5550db105 100644 --- a/src/Text/Pandoc/Writers/HTML.hs +++ b/src/Text/Pandoc/Writers/HTML.hs @@ -237,15 +237,14 @@ elementToHtml opts (Sec level num id' title' elements) = do let stuff = header'' : innerContents let slide = writerSlideVariant opts /= NoSlides && level == 1 let titleSlide = slide && null elements - let classes = [theclass "titleslide" | titleSlide] ++ - [theclass "slide" | slide] + let attrs = [prefixedId opts id' | writerSectionDivs opts] ++ + [theclass "titleslide" | titleSlide] ++ + [theclass "slide" | slide] let inNl x = nl opts : intersperse (nl opts) x ++ [nl opts] return $ if writerSectionDivs opts || slide then if writerHtml5 opts - then tag "section" ! (prefixedId opts id' : classes) - << inNl stuff - else thediv ! (prefixedId opts id' : classes) - << inNl stuff + then tag "section" ! attrs << inNl stuff + else thediv ! attrs << inNl stuff else toHtmlFromList $ intersperse (nl opts) stuff -- | Convert list of Note blocks to a footnote
. diff --git a/tests/s5.basic.html b/tests/s5.basic.html index 88ac22631..0658dcf4b 100644 --- a/tests/s5.basic.html +++ b/tests/s5.basic.html @@ -34,14 +34,14 @@

Sam Smith
Jen Jones

July 15, 2006

-
+

First slide

  • first bullet
  • second bullet
-
+

Math

  • $\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}$
  • diff --git a/tests/s5.fancy.html b/tests/s5.fancy.html index 0e10ae0b0..39188bb1e 100644 --- a/tests/s5.fancy.html +++ b/tests/s5.fancy.html @@ -235,14 +235,14 @@

    Sam Smith
    Jen Jones

    July 15, 2006

-
+

First slide

  • first bullet
  • second bullet
-
+

Math

  • $\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}$
  • -- cgit v1.2.3