@@ -250,9 +250,10 @@ showSecNum = concat . intersperse "." . map show
250250-- | Converts an Element to a list item for a table of contents,
251251-- retrieving the appropriate identifier from state.
252252elementToListItem :: WriterOptions -> Element -> State WriterState (Maybe Html)
253−elementToListItem opts (Sec lev num (id',classes,keyvals) headerText subsecs)
253+elementToListItem opts (Sec lev num (id',classes,_) headerText subsecs)
254254 | lev <= writerTOCDepth opts = do
255− let sectnum = if writerNumberSections opts && not (null num)
255+ let sectnum = if writerNumberSections opts && not (null num) &&
256+ "unnumbered" `notElem` classes
256257 then (H.span ! A.class_ "toc-section-number"
257258 $ toHtml $ showSecNum num) >> preEscapedString " "
258259 else mempty
@@ -287,22 +288,24 @@ elementToHtml slideLevel opts (Sec level num (id',classes,keyvals) title' elemen
287288 -- title slides have no content of their own
288289 then filter isSec elements
289290 else elements
290− let header'' = if (writerSectionDivs opts ||
291− writerSlideVariant opts == S5Slides ||
292− slide)
293− then header'
294− else header' ! prefixedId opts id'
295291 let inNl x = mconcat $ nl opts : intersperse (nl opts) x ++ [nl opts]
296− let classes = ["titleslide" | titleSlide] ++ ["slide" | slide] ++
297− ["level" ++ show level]
292+ let classes' = ["titleslide" | titleSlide] ++ ["slide" | slide] ++
293+ ["section" | (slide || writerSectionDivs opts) &&
294+ not (writerHtml5 opts) ] ++
295+ ["level" ++ show level | slide || writerSectionDivs opts ]
296+ ++ classes
298297 let secttag = if writerHtml5 opts
299− then H5.section ! A.class_ (toValue $ unwords classes)
300− else H.div ! A.class_ (toValue $ unwords ("section":classes))
298+ then H5.section
299+ else H.div
300+ let attr = (id',classes',keyvals)
301301 return $ if titleSlide
302− then mconcat $ (secttag ! prefixedId opts id' $ header'') : innerContents
302+ then mconcat $
303+ (addAttrs opts attr $ secttag $ header') : innerContents
303304 else if writerSectionDivs opts || slide
304− then secttag ! prefixedId opts id' $ inNl $ header'' : innerContents
305− else mconcat $ intersperse (nl opts) $ header'' : innerContents
305+ then addAttrs opts attr
306+ $ secttag $ inNl $ header' : innerContents
307+ else mconcat $ intersperse (nl opts)
308+ $ addAttrs opts attr header' : innerContents
306309
307310-- | Convert list of Note blocks to a footnote <div>.
308311-- Assumes notes are sorted.
@@ -376,8 +379,8 @@ addAttrs opts attr h = foldl (!) h (attrsToHtml opts attr)
376379
377380attrsToHtml :: WriterOptions -> Attr -> [Attribute]
378381attrsToHtml opts (id',classes',keyvals) =
379− [A.class_ (toValue $ unwords classes') | not (null classes')] ++
380382 [prefixedId opts id' | not (null id')] ++
383+ [A.class_ (toValue $ unwords classes') | not (null classes')] ++
381384 map (\(x,y) -> customAttribute (fromString x) (toValue y)) keyvals
382385
383386imageExts :: [String]
@@ -423,11 +426,11 @@ blockToHtml opts (CodeBlock (id',classes,keyvals) rawCode) = do
423426 then map (\c -> if map toLower c == "haskell"
424427 then "literatehaskell"
425428 else c) classes
426− else filter (/= "literate") classes
429+ else classes
427430 adjCode = if tolhs
428431 then unlines . map ("> " ++) . lines $ rawCode
429432 else rawCode
430− case highlight formatHtmlBlock (id',classes,keyvals) adjCode of
433+ case highlight formatHtmlBlock (id',classes',keyvals) adjCode of
431434 Nothing -> return $ addAttrs opts (id',classes,keyvals)
432435 $ H.pre $ H.code $ toHtml adjCode
433436 Just h -> modify (\st -> st{ stHighlighting = True }) >>
@@ -461,14 +464,14 @@ blockToHtml opts (Header level (ident,_,_) lst) = do
461464 then H.a ! A.href (toValue $
462465 '#' : writerIdentifierPrefix opts ++ ident) $ contents'
463466 else contents'
464− return $ (case level of
467+ return $ case level of
465468 1 -> H.h1 contents''
466469 2 -> H.h2 contents''
467470 3 -> H.h3 contents''
468471 4 -> H.h4 contents''
469472 5 -> H.h5 contents''
470473 6 -> H.h6 contents''
471− _ -> H.p contents'')
474+ _ -> H.p contents''
472475blockToHtml opts (BulletList lst) = do
473476 contents <- mapM (blockListToHtml opts) lst
474477 let lst' = unordList opts contents