diff --git a/src/Text/Pandoc/Writers/HTML.hs b/src/Text/Pandoc/Writers/HTML.hs index db2ab201e..427edcde3 100644 --- a/src/Text/Pandoc/Writers/HTML.hs +++ b/src/Text/Pandoc/Writers/HTML.hs @@ -250,9 +250,10 @@ showSecNum = concat . intersperse "." . map show -- | Converts an Element to a list item for a table of contents, -- retrieving the appropriate identifier from state. elementToListItem :: WriterOptions -> Element -> State WriterState (Maybe Html) -elementToListItem opts (Sec lev num (id',classes,keyvals) headerText subsecs) +elementToListItem opts (Sec lev num (id',classes,_) headerText subsecs) | lev <= writerTOCDepth opts = do - let sectnum = if writerNumberSections opts && not (null num) + let sectnum = if writerNumberSections opts && not (null num) && + "unnumbered" `notElem` classes then (H.span ! A.class_ "toc-section-number" $ toHtml $ showSecNum num) >> preEscapedString " " else mempty @@ -287,22 +288,24 @@ elementToHtml slideLevel opts (Sec level num (id',classes,keyvals) title' elemen -- title slides have no content of their own then filter isSec elements else elements - let header'' = if (writerSectionDivs opts || - writerSlideVariant opts == S5Slides || - slide) - then header' - else header' ! prefixedId opts id' let inNl x = mconcat $ nl opts : intersperse (nl opts) x ++ [nl opts] - let classes = ["titleslide" | titleSlide] ++ ["slide" | slide] ++ - ["level" ++ show level] + let classes' = ["titleslide" | titleSlide] ++ ["slide" | slide] ++ + ["section" | (slide || writerSectionDivs opts) && + not (writerHtml5 opts) ] ++ + ["level" ++ show level | slide || writerSectionDivs opts ] + ++ classes let secttag = if writerHtml5 opts - then H5.section ! A.class_ (toValue $ unwords classes) - else H.div ! A.class_ (toValue $ unwords ("section":classes)) + then H5.section + else H.div + let attr = (id',classes',keyvals) return $ if titleSlide - then mconcat $ (secttag ! prefixedId opts id' $ header'') : innerContents + then mconcat $ + (addAttrs opts attr $ secttag $ header') : innerContents else if writerSectionDivs opts || slide - then secttag ! prefixedId opts id' $ inNl $ header'' : innerContents - else mconcat $ intersperse (nl opts) $ header'' : innerContents + then addAttrs opts attr + $ secttag $ inNl $ header' : innerContents + else mconcat $ intersperse (nl opts) + $ addAttrs opts attr header' : innerContents -- | Convert list of Note blocks to a footnote
unsplit
is an arrow that takes a pair of values and combines them to return a single value:
> unsplit :: (Arrow a) => (b -> c -> d) -> a (b, c) d
-> unsplit = arr . uncurry
-> -- arr (\op (x,y) -> x `op` y)
+> unsplit :: (Arrow a) => (b -> c -> d) -> a (b, c) d
+> unsplit = arr . uncurry
+> -- arr (\op (x,y) -> x `op` y)
(***)
combines two arrows into a new arrow by running the two arrows on a pair of values (one arrow on the first item of the pair and one arrow on the second item of the pair).
f *** g = first f >>> second g
Block quote:
diff --git a/tests/s5.basic.html b/tests/s5.basic.html index f4e93eb6d..ceb896b8e 100644 --- a/tests/s5.basic.html +++ b/tests/s5.basic.html @@ -36,14 +36,14 @@