HTML slides: only add id to div/section if --section-divs selected.

This commit is contained in:
John MacFarlane 2011-10-02 23:19:03 -07:00
parent 06054ff740
commit c335b6cbd8
3 changed files with 9 additions and 10 deletions

View file

@ -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 <div>.

View file

@ -34,14 +34,14 @@
<h3>Sam Smith<br/>Jen Jones</h3>
<h4>July 15, 2006</h4>
</div>
<div id="first-slide" class="slide">
<div class="slide">
<h1>First slide</h1>
<ul>
<li>first bullet</li>
<li>second bullet</li>
</ul>
</div>
<div id="math" class="slide">
<div class="slide">
<h1>Math</h1>
<ul>
<li><span class="math">$\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}$</span></li>

View file

@ -235,14 +235,14 @@
<h3>Sam Smith<br/>Jen Jones</h3>
<h4>July 15, 2006</h4>
</div>
<div id="first-slide" class="slide">
<div class="slide">
<h1>First slide</h1>
<ul class="incremental">
<li>first bullet</li>
<li>second bullet</li>
</ul>
</div>
<div id="math" class="slide">
<div class="slide">
<h1>Math</h1>
<ul class="incremental">
<li><span class="LaTeX">$\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}$</span></li>