git.iko.soy/typeable/pandoc
on master help sign in
Added syntax for "pauses" in beamer or reaveljs slide shows.

This gives . . . a pause.

commit6217623d0a8538a1fe3f65264267ff0f436b3e84 authorJohn MacFarlane <fiddlosopher@gmail.com> dateSun 24 Mar 2013, 21:02 (14 years ago) parentf2f3c33
3 files changed+52−30
README+42−30 src/Text/Pandoc/Writers/HTML.hs+4 src/Text/Pandoc/Writers/LaTeX.hs+6
README+42−30
@@ -2416,9 +2416,9 @@ Producing slide shows with Pandoc
24162416=================================
24172417
24182418You can use Pandoc to produce an HTML + javascript slide presentation
2419−that can be viewed via a web browser. There are four ways to do this,
2420−using [S5], [DZSlides], [Slidy], or [Slideous]. You can also produce a
2421−PDF slide show using LaTeX [beamer].
2419+that can be viewed via a web browser. There are five ways to do this,
2420+using [S5], [DZSlides], [Slidy], [Slideous], or [reveal.js].
2421+You can also produce a PDF slide show using LaTeX [beamer].
24222422
24232423Here's the markdown source for a simple slide show, `habits.txt`:
24242424
@@ -2454,31 +2454,31 @@ Here's the markdown source for a simple slide show, `habits.txt`:
24542454 - Get in bed
24552455 - Count sheep
24562456
2457−To produce the slide show, simply type
2457+To produce an HTML/javascript slide show, simply type
24582458
2459− pandoc -t s5 -s habits.txt -o habits.html
2459+ pandoc -t FORMAT -s habits.txt -o habits.html
24602460
2461−for S5,
2461+where `FORMAT` is either `s5`, `slidy`, `slideous`, `dzslides`, or `revealjs`.
24622462
2463− pandoc -t slidy -s habits.txt -o habits.html
2463+For Slidy, Slideous, reveal.js, and S5, the file produced by pandoc with the
2464+`-s/--standalone` option embeds a link to javascripts and CSS files, which are
2465+assumed to be available at the relative path `s5/default` (for S5), `slideous`
2466+(for Slideous), `reveal.js` (for reveal.js), or at the Slidy website at
2467+`w3.org` (for Slidy). (These paths can be changed by setting the `slidy-url`,
2468+`slideous-url`, `revealjs-url`, or `s5-url` variables; see `--variable`,
2469+above.) For DZSlides, the (relatively short) javascript and css are included in
2470+the file by default.
24642471
2465−for Slidy,
2466−
2467− pandoc -t slideous -s habits.txt -o habits.html
2468−
2469−for Slideous,
2470−
2471− pandoc -t dzslides -s habits.txt -o habits.html
2472+With all HTML slide formats, the `--self-contained` option can be used to
2473+produce a single file that contains all of the data necessary to display the
2474+slide show, including linked scripts, stylesheets, images, and videos.
24722475
2473−for DZSlides, or
2476+To produce a PDF slide show using beamer, type
24742477
24752478 pandoc -t beamer habits.txt -o habits.pdf
24762479
2477−for beamer.
2478−
2479−With all HTML slide formats, the `--self-contained` option can be used to
2480−produce a single file that contains all of the data necessary to display the
2481−slide show, including linked scripts, stylesheets, images, and videos.
2480+Note that a reveal.js slide show can also be converted to a PDF
2481+by printing it to a file from the browser.
24822482
24832483Structuring the slide show
24842484--------------------------
@@ -2514,16 +2514,6 @@ you can just use level 1 headers for all each slide. (In that case, level 1
25142514will be the slide level.) But you can also structure the slide show into
25152515sections, as in the example above.
25162516
2517−For Slidy, Slideous and S5, the file produced by pandoc with the
2518−`-s/--standalone`
2519−option embeds a link to javascripts and CSS files, which are assumed to
2520−be available at the relative path `s5/default` (for S5) or `slideous`
2521−(for Slideous), or at the Slidy
2522−website at `w3.org` (for Slidy). (These paths can be changed by setting
2523−the `slidy-url`, `slideous-url` or `s5-url` variables; see `--variable`,
2524−above.) For DZSlides,
2525−the (relatively short) javascript and css are included in the file by default.
2526−
25272517Incremental lists
25282518-----------------
25292519
@@ -2539,6 +2529,21 @@ all at once with the `-i` option), put it in a block quote:
25392529In this way incremental and nonincremental lists can be mixed in
25402530a single document.
25412531
2532+Inserting pauses
2533+----------------
2534+
2535+In reveal.js and beamer slide shows, you can add "pauses" within
2536+a slide by including a paragraph containing three dots, separated
2537+by spaces:
2538+
2539+ # Slide with a pause
2540+
2541+ content before the pause
2542+
2543+ . . .
2544+
2545+ content after the pause
2546+
25422547Styling the slides
25432548------------------
25442549
@@ -2553,6 +2558,13 @@ files it does not find in the user data directory.
25532558For dzslides, the CSS is included in the HTML file itself, and may
25542559be modified there.
25552560
2561+For reveal.js, themes can be used by setting the `theme` variable,
2562+for example:
2563+
2564+ -V theme=moon
2565+
2566+Or you can specify a custom stylesheet using the `--css` option.
2567+
25562568To style beamer slides, you can specify a beamer "theme" or "colortheme"
25572569using the `-V` option:
25582570
src/Text/Pandoc/Writers/HTML.hs+4
@@ -426,6 +426,10 @@ blockToHtml opts (Para [Image txt (s,'f':'i':'g':':':tit)]) = do
426426 [nl opts, img, capt, nl opts]
427427 else H.div ! A.class_ "figure" $ mconcat
428428 [nl opts, img, capt, nl opts]
429+-- . . . indicates a pause in a slideshow
430+blockToHtml opts (Para [Str ".",Space,Str ".",Space,Str "."])
431+ | writerSlideVariant opts == RevealJsSlides =
432+ blockToHtml opts (RawBlock "html" "<div class=\"fragment\" />")
429433blockToHtml opts (Para lst) = do
430434 contents <- inlineListToHtml opts lst
431435 return $ H.p contents
src/Text/Pandoc/Writers/LaTeX.hs+6
@@ -293,6 +293,12 @@ blockToLaTeX (Para [Image txt (src,'f':'i':'g':':':tit)]) = do
293293 img <- inlineToLaTeX (Image txt (src,tit))
294294 return $ "\\begin{figure}[htbp]" $$ "\\centering" $$ img $$
295295 capt $$ "\\end{figure}"
296+-- . . . indicates pause in beamer slides
297+blockToLaTeX (Para [Str ".",Space,Str ".",Space,Str "."]) = do
298+ beamer <- writerBeamer `fmap` gets stOptions
299+ if beamer
300+ then blockToLaTeX (RawBlock "latex" "\\pause")
301+ else inlineListToLaTeX [Str ".",Space,Str ".",Space,Str "."]
296302blockToLaTeX (Para lst) =
297303 inlineListToLaTeX $ dropWhile isLineBreakOrSpace lst
298304blockToLaTeX (BlockQuote lst) = do