git.iko.soy/typeable/pandoc
on master help sign in
Made . . . for pause work in all slide show formats except slideous.
commit81e2df32c92ee95771f2613b9ad30aeaf11423e5 authorJohn MacFarlane <fiddlosopher@gmail.com> dateSun 8 Sep 2013, 15:47 (13 years ago) parent1911b61
3 files changed+18−14
README+2−3 changelog+1−4 src/Text/Pandoc/Writers/HTML.hs+15−7
README+2−3
@@ -2680,9 +2680,8 @@ a single document.
26802680Inserting pauses
26812681----------------
26822682
2683−In reveal.js and beamer slide shows, you can add "pauses" within
2684−a slide by including a paragraph containing three dots, separated
2685−by spaces:
2683+You can add "pauses" within a slide by including a paragraph containing
2684+three dots, separated by spaces:
26862685
26872686 # Slide with a pause
26882687
changelog+1−4
@@ -413,7 +413,7 @@
413413 as markdown citations, it is redundant to have a bibliography,
414414 since one will be generated automatically.)
415415
416− * Added syntax for "pauses" in beamer or reaveljs slide shows.
416+ * Added syntax for "pauses" in slide shows:
417417
418418 This gives
419419
@@ -421,9 +421,6 @@
421421
422422 a pause.
423423
424− [note - no longer seems to work in recente revealjs - perhaps
425− this should be reverted]
426−
427424 * Use new flexible metadata type.
428425
429426 + Depend on `pandoc-types` 1.12. This changes the type of
src/Text/Pandoc/Writers/HTML.hs+15−7
@@ -268,11 +268,24 @@ elementToHtml slideLevel opts (Sec level num (id',classes,keyvals) title' elemen
268268 else blockToHtml opts (Header level' (id',classes,keyvals) title')
269269 let isSec (Sec _ _ _ _ _) = True
270270 isSec (Blk _) = False
271+ let isPause (Blk x) = x == Para [Str ".",Space,Str ".",Space,Str "."]
272+ isPause _ = False
273+ let fragmentClass = case writerSlideVariant opts of
274+ RevealJsSlides -> "fragment"
275+ _ -> "incremental"
276+ let inDiv xs = Blk (RawBlock (Format "html") ("<div class=\""
277+ ++ fragmentClass ++ "\">")) :
278+ (xs ++ [Blk (RawBlock (Format "html") "</div>")])
271279 innerContents <- mapM (elementToHtml slideLevel opts)
272280 $ if titleSlide
273281 -- title slides have no content of their own
274282 then filter isSec elements
275− else elements
283+ else if slide
284+ then case splitBy isPause elements of
285+ [] -> []
286+ [x] -> x
287+ xs -> concatMap inDiv xs
288+ else elements
276289 let inNl x = mconcat $ nl opts : intersperse (nl opts) x ++ [nl opts]
277290 let classes' = ["titleslide" | titleSlide] ++ ["slide" | slide] ++
278291 ["section" | (slide || writerSectionDivs opts) &&
@@ -401,10 +414,6 @@ blockToHtml opts (Para [Image txt (s,'f':'i':'g':':':tit)]) = do
401414 [nl opts, img, capt, nl opts]
402415 else H.div ! A.class_ "figure" $ mconcat
403416 [nl opts, img, capt, nl opts]
404−-- . . . indicates a pause in a slideshow
405−blockToHtml opts (Para [Str ".",Space,Str ".",Space,Str "."])
406− | writerSlideVariant opts == RevealJsSlides =
407− blockToHtml opts (RawBlock "html" "<div class=\"fragment\" />")
408417blockToHtml opts (Para lst) = do
409418 contents <- inlineListToHtml opts lst
410419 return $ H.p contents
@@ -580,8 +589,7 @@ toListItem opts item = nl opts >> H.li item
580589
581590blockListToHtml :: WriterOptions -> [Block] -> State WriterState Html
582591blockListToHtml opts lst =
583− mapM (blockToHtml opts) lst >>=
584− return . mconcat . intersperse (nl opts)
592+ fmap (mconcat . intersperse (nl opts)) $ mapM (blockToHtml opts) lst
585593
586594-- | Convert list of Pandoc inline elements to HTML.
587595inlineListToHtml :: WriterOptions -> [Inline] -> State WriterState Html