aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2010-07-22 23:23:47 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2010-07-22 23:23:47 -0700
commit851d39f8f88dcde7ac704d2dd047253271866505 (patch)
tree0f21f107cc6f7b09d0fe8081622f2902ad1e77cb
parenta11b5309351cfa813face2d07cdbc32b1fa6cf0f (diff)
downloadpandoc-851d39f8f88dcde7ac704d2dd047253271866505.tar.gz
Improved cutUp function, removed extra </div>
-rw-r--r--src/Text/Pandoc/Writers/HTML.hs22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/Text/Pandoc/Writers/HTML.hs b/src/Text/Pandoc/Writers/HTML.hs
index abe7e3a42..d2a400c5c 100644
--- a/src/Text/Pandoc/Writers/HTML.hs
+++ b/src/Text/Pandoc/Writers/HTML.hs
@@ -105,21 +105,23 @@ pandocToHtml opts (Pandoc (Meta title' authors' date') blocks) = do
toc <- if writerTableOfContents opts
then tableOfContents opts sects
else return Nothing
+ let startSlide = RawHtml "<div class=\"slide\">\n"
+ endSlide = RawHtml "</div>\n"
let cutUp (HorizontalRule : Header 1 ys : xs) = cutUp (Header 1 ys : xs)
- cutUp (HorizontalRule : xs) = RawHtml "</div>\n<div class=\"slide\">\n" :
- cutUp xs
- cutUp (Header 1 ys : xs) = RawHtml ("</div>\n<div class=\"slide title\">\n") :
- Header 1 ys : cutUp xs
+ cutUp (HorizontalRule : xs) = [endSlide, startSlide] ++ cutUp xs
+ cutUp (Header 1 ys : xs) = [endSlide, startSlide] ++
+ (Header 1 ys : cutUp xs)
cutUp (x:xs) = x : cutUp xs
cutUp [] = []
- let preamble = case blocks of
- (HorizontalRule : _) -> []
- (Header 1 _ : _) -> []
- _ -> [RawHtml "<div class=\"slide\">\n"]
+ let slides = case blocks of
+ (HorizontalRule : xs) -> [startSlide] ++ cutUp xs ++ [endSlide]
+ (Header 1 ys : xs) -> [startSlide, Header 1 ys] ++
+ cutUp xs ++ [endSlide]
+ _ -> [startSlide] ++ cutUp blocks ++
+ [endSlide]
blocks' <- liftM toHtmlFromList $
if writerSlideVariant opts `elem` [SlidySlides, S5Slides]
- then mapM (blockToHtml opts) $ preamble ++
- cutUp blocks ++ [RawHtml "</div>"]
+ then mapM (blockToHtml opts) slides
else mapM (elementToHtml opts) sects
st <- get
let notes = reverse (stNotes st)