summaryrefslogtreecommitdiff
path: root/src/Text/Pandoc
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2014-08-09 10:29:39 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2014-08-09 10:29:39 -0700
commit4983083079a6d5095e006a81997d8bc1ddbf1d8e (patch)
tree85e8054ae0d565b9778e366b56d50cfe819b2e5f /src/Text/Pandoc
parent6c44e66f2f0c581e8d62b09d611901acec7d6456 (diff)
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.
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r--src/Text/Pandoc/Writers/HTML.hs3
1 files changed, 3 insertions, 0 deletions
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)