aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn MacFarlane <fiddlosopher@gmail.com>2011-12-18 13:09:58 -0800
committerJohn MacFarlane <fiddlosopher@gmail.com>2011-12-18 13:09:58 -0800
commit5e38d6a68940b937c3ba069596978e5992e20d4a (patch)
treefcd8426fa3f42df6f0232c977cbd59f537d14ad4 /src
parentfba4f1f37eecb9b4b835b485a6ed92dd909cdcc0 (diff)
downloadpandoc-5e38d6a68940b937c3ba069596978e5992e20d4a.tar.gz
HTML writer: Put classes "section" and "level[1-6]" on section divs.
(In HTML 5, the "section" class is omitted, since the tag itself is "section.")
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/Writers/HTML.hs12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/Text/Pandoc/Writers/HTML.hs b/src/Text/Pandoc/Writers/HTML.hs
index 5843bc5ef..3f47c386d 100644
--- a/src/Text/Pandoc/Writers/HTML.hs
+++ b/src/Text/Pandoc/Writers/HTML.hs
@@ -248,14 +248,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 attrs = [prefixedId opts id' | writerSectionDivs opts] ++
- [A.class_ "titleslide" | titleSlide] ++
- [A.class_ "slide" | slide]
+ let classes = ["titleslide" | titleSlide] ++ ["slide" | slide] ++
+ ["level" ++ show level]
let inNl x = mconcat $ nl opts : intersperse (nl opts) x ++ [nl opts]
+ let secttag = if writerHtml5 opts
+ then H.section ! A.class_ (toValue $ unwords classes)
+ else H.div ! A.class_ (toValue $ unwords ("section":classes))
return $ if writerSectionDivs opts || slide
- then if writerHtml5 opts
- then foldl (!) (H.section $ inNl stuff) attrs
- else foldl (!) (H.div $ inNl stuff) attrs
+ then secttag ! prefixedId opts id' $ inNl stuff
else mconcat $ intersperse (nl opts) stuff
-- | Convert list of Note blocks to a footnote <div>.