From 220bd121d82e01ba15dd85b63def93e01fef220c Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Wed, 13 Apr 2011 18:36:21 -0700 Subject: Allow --section-divs with slidy output. --- src/Text/Pandoc/Writers/HTML.hs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'src/Text') diff --git a/src/Text/Pandoc/Writers/HTML.hs b/src/Text/Pandoc/Writers/HTML.hs index 0b791687f..f49cd3874 100644 --- a/src/Text/Pandoc/Writers/HTML.hs +++ b/src/Text/Pandoc/Writers/HTML.hs @@ -105,10 +105,6 @@ pandocToHtml opts (Pandoc (Meta title' authors' date') blocks) = do date <- if standalone then inlineListToHtml opts date' else return noHtml - let sects = hierarchicalize blocks - toc <- if writerTableOfContents opts - then tableOfContents opts sects - else return Nothing let startSlide = RawBlock "html" "
\n" endSlide = RawBlock "html" "
\n" let cutUp (HorizontalRule : Header 1 ys : xs) = cutUp (Header 1 ys : xs) @@ -123,10 +119,14 @@ pandocToHtml opts (Pandoc (Meta title' authors' date') blocks) = do cutUp xs ++ [endSlide] _ -> [startSlide] ++ cutUp blocks ++ [endSlide] + let sects = if writerSlideVariant opts `elem` [SlidySlides, S5Slides] + then hierarchicalize slides + else hierarchicalize blocks + toc <- if writerTableOfContents opts + then tableOfContents opts sects + else return Nothing blocks' <- liftM (toHtmlFromList . intersperse (nl opts)) $ - if writerSlideVariant opts `elem` [SlidySlides, S5Slides] - then mapM (blockToHtml opts) slides - else mapM (elementToHtml opts) sects + mapM (elementToHtml opts) sects st <- get let notes = reverse (stNotes st) let thebody = blocks' +++ footnoteSection opts notes @@ -238,12 +238,12 @@ elementToHtml opts (Sec level num id' title' elements) = do modify $ \st -> st{stSecNum = num} -- update section number header' <- blockToHtml opts (Header level title') innerContents <- mapM (elementToHtml opts) elements - let slides = writerSlideVariant opts `elem` [SlidySlides, S5Slides] + let s5 = writerSlideVariant opts == S5Slides let header'' = header' ! [prefixedId opts id' | not (writerStrictMarkdown opts || - writerSectionDivs opts || slides)] + writerSectionDivs opts || s5)] let stuff = header'' : innerContents - return $ if slides -- S5 gets confused by the extra divs around sections + return $ if s5 -- S5 gets confused by the extra divs around sections then toHtmlFromList $ intersperse (nl opts) stuff else if writerSectionDivs opts then if writerHtml5 opts -- cgit v1.2.3