git.iko.soy/typeable/pandoc
on master help sign in
HTML slides: only add id to div/section if --section-divs selected.
commitc335b6cbd8e73537f6482ffc127bb428f586602e authorJohn MacFarlane <fiddlosopher@gmail.com> dateSun 2 Oct 2011, 23:19 (15 years ago) parent06054ff
3 files changed+9−10
src/Text/Pandoc/Writers/HTML.hs+5−6 tests/s5.basic.html+2−2 tests/s5.fancy.html+2−2
src/Text/Pandoc/Writers/HTML.hs+5−6
@@ -237,15 +237,14 @@ elementToHtml opts (Sec level num id' title' elements) = do
237237 let stuff = header'' : innerContents
238238 let slide = writerSlideVariant opts /= NoSlides && level == 1
239239 let titleSlide = slide && null elements
240− let classes = [theclass "titleslide" | titleSlide] ++
241− [theclass "slide" | slide]
240+ let attrs = [prefixedId opts id' | writerSectionDivs opts] ++
241+ [theclass "titleslide" | titleSlide] ++
242+ [theclass "slide" | slide]
242243 let inNl x = nl opts : intersperse (nl opts) x ++ [nl opts]
243244 return $ if writerSectionDivs opts || slide
244245 then if writerHtml5 opts
245− then tag "section" ! (prefixedId opts id' : classes)
246− << inNl stuff
247− else thediv ! (prefixedId opts id' : classes)
248− << inNl stuff
246+ then tag "section" ! attrs << inNl stuff
247+ else thediv ! attrs << inNl stuff
249248 else toHtmlFromList $ intersperse (nl opts) stuff
250249
251250-- | Convert list of Note blocks to a footnote <div>.
tests/s5.basic.html+2−2
@@ -34,14 +34,14 @@
3434 <h3>Sam Smith<br/>Jen Jones</h3>
3535 <h4>July 15, 2006</h4>
3636</div>
37−<div id="first-slide" class="slide">
37+<div class="slide">
3838<h1>First slide</h1>
3939<ul>
4040<li>first bullet</li>
4141<li>second bullet</li>
4242</ul>
4343</div>
44−<div id="math" class="slide">
44+<div class="slide">
4545<h1>Math</h1>
4646<ul>
4747<li><span class="math">$\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}$</span></li>
tests/s5.fancy.html+2−2
@@ -235,14 +235,14 @@
235235 <h3>Sam Smith<br/>Jen Jones</h3>
236236 <h4>July 15, 2006</h4>
237237</div>
238−<div id="first-slide" class="slide">
238+<div class="slide">
239239<h1>First slide</h1>
240240<ul class="incremental">
241241<li>first bullet</li>
242242<li>second bullet</li>
243243</ul>
244244</div>
245−<div id="math" class="slide">
245+<div class="slide">
246246<h1>Math</h1>
247247<ul class="incremental">
248248<li><span class="LaTeX">$\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}$</span></li>