git.iko.soy/typeable/pandoc
on master help sign in
HTML writer: Don't include empty TOC items for slide shows.

Previously creating a slide with a horizontal rule would result in an empty list item in the TOC. This patch fixes that.

commit4983083079a6d5095e006a81997d8bc1ddbf1d8e authorJohn MacFarlane <jgm@berkeley.edu> dateSat 9 Aug 2014, 10:29 (12 years ago) parent6c44e66
1 file changed+3
src/Text/Pandoc/Writers/HTML.hs+3
src/Text/Pandoc/Writers/HTML.hs+3
@@ -236,6 +236,9 @@ showSecNum = concat . intersperse "." . map show
236236-- | Converts an Element to a list item for a table of contents,
237237-- retrieving the appropriate identifier from state.
238238elementToListItem :: WriterOptions -> Element -> State WriterState (Maybe Html)
239+-- Don't include the empty headers created in slide shows
240+-- shows when an hrule is used to separate slides without a new title:
241+elementToListItem _ (Sec _ _ _ [Str "\0"] _) = return Nothing
239242elementToListItem opts (Sec lev num (id',classes,_) headerText subsecs)
240243 | lev <= writerTOCDepth opts = do
241244 let num' = zipWith (+) num (writerNumberOffset opts ++ repeat 0)