From 2a4e5f9daa41eb726a66fc6bd94eea945bca9e24 Mon Sep 17 00:00:00 2001 From: fiddlosopher Date: Sat, 9 Jan 2010 03:13:08 +0000 Subject: HTML writer: don't include empty UL if --toc but no sections. Resolves Issue #199. git-svn-id: https://pandoc.googlecode.com/svn/trunk@1799 788f1e2b-df1e-0410-8736-df70ead52e1b --- src/Text/Pandoc/Writers/HTML.hs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Text/Pandoc/Writers/HTML.hs b/src/Text/Pandoc/Writers/HTML.hs index 7d6462148..cca65751f 100644 --- a/src/Text/Pandoc/Writers/HTML.hs +++ b/src/Text/Pandoc/Writers/HTML.hs @@ -160,7 +160,11 @@ tableOfContents _ [] = return noHtml tableOfContents opts sects = do let opts' = opts { writerIgnoreNotes = True } contents <- mapM (elementToListItem opts') sects - return $ thediv ! [prefixedId opts' "TOC"] $ unordList $ catMaybes contents + let tocList = catMaybes contents + return $ thediv ! [prefixedId opts' "TOC"] $ + if null tocList + then noHtml + else unordList tocList -- | Convert section number to string showSecNum :: [Int] -> String -- cgit v1.2.3