From 4983083079a6d5095e006a81997d8bc1ddbf1d8e Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Sat, 9 Aug 2014 10:29:39 -0700 Subject: 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. --- src/Text/Pandoc/Writers/HTML.hs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/Text') diff --git a/src/Text/Pandoc/Writers/HTML.hs b/src/Text/Pandoc/Writers/HTML.hs index a34f6b4dd..36ce2ba21 100644 --- a/src/Text/Pandoc/Writers/HTML.hs +++ b/src/Text/Pandoc/Writers/HTML.hs @@ -236,6 +236,9 @@ 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) +-- Don't include the empty headers created in slide shows +-- shows when an hrule is used to separate slides without a new title: +elementToListItem _ (Sec _ _ _ [Str "\0"] _) = return Nothing elementToListItem opts (Sec lev num (id',classes,_) headerText subsecs) | lev <= writerTOCDepth opts = do let num' = zipWith (+) num (writerNumberOffset opts ++ repeat 0) -- cgit v1.2.3