git.iko.soy/typeable/pandoc
on master help sign in
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

commit2a4e5f9daa41eb726a66fc6bd94eea945bca9e24 authorfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> dateSat 9 Jan 2010, 03:13 (17 years ago) parent13a262a
1 file changed+5−1
src/Text/Pandoc/Writers/HTML.hs+5−1
src/Text/Pandoc/Writers/HTML.hs+5−1
@@ -160,7 +160,11 @@ tableOfContents _ [] = return noHtml
160160tableOfContents opts sects = do
161161 let opts' = opts { writerIgnoreNotes = True }
162162 contents <- mapM (elementToListItem opts') sects
163− return $ thediv ! [prefixedId opts' "TOC"] $ unordList $ catMaybes contents
163+ let tocList = catMaybes contents
164+ return $ thediv ! [prefixedId opts' "TOC"] $
165+ if null tocList
166+ then noHtml
167+ else unordList tocList
164168
165169-- | Convert section number to string
166170showSecNum :: [Int] -> String