git.iko.soy/typeable/pandoc
on master help sign in
Beamer: add allowframebreaks to slide if set in header classes.

It's recommended that your bibliography slide have this attribute: # References {.allowframebreaks} This causes multiple slides to be created if necessary, depending on the length of the bibliography.

commita97f39c12e7b47a272575b69ad4cdd38966c043e authorJohn MacFarlane <jgm@berkeley.edu> dateFri 26 Jul 2013, 12:40 (13 years ago) parentd5fad23
2 files changed+21−8
README+10 src/Text/Pandoc/Writers/LaTeX.hs+11−8
README+10
@@ -2674,6 +2674,16 @@ using the `-V` option:
26742674
26752675 pandoc -t beamer habits.txt -V theme:Warsaw -o habits.pdf
26762676
2677+Note that header attributes will turn into slide attributes
2678+(on a `<div>` or `<section>`) in HTML slide formats, allowing you
2679+to style individual slides. In Beamer, the only header attribute
2680+that affects slides is the `allowframebreaks` class, which sets the
2681+`allowframebreaks` option, causing multiple slides to be created
2682+if the content overfills the frame. This is recommended especially for
2683+bibliographies:
2684+
2685+ # References {.allowframebreaks}
2686+
26772687Literate Haskell support
26782688========================
26792689
src/Text/Pandoc/Writers/LaTeX.hs+11−8
@@ -232,7 +232,7 @@ toSlides bs = do
232232
233233elementToBeamer :: Int -> Element -> State WriterState [Block]
234234elementToBeamer _slideLevel (Blk b) = return [b]
235−elementToBeamer slideLevel (Sec lvl _num (ident,classes,_) tit elts)
235+elementToBeamer slideLevel (Sec lvl _num (ident,classes,kvs) tit elts)
236236 | lvl > slideLevel = do
237237 bs <- concat `fmap` mapM (elementToBeamer slideLevel) elts
238238 return $ Para ( RawInline "latex" "\\begin{block}{"
@@ -240,7 +240,7 @@ elementToBeamer slideLevel (Sec lvl _num (ident,classes,_) tit elts)
240240 : bs ++ [RawBlock "latex" "\\end{block}"]
241241 | lvl < slideLevel = do
242242 bs <- concat `fmap` mapM (elementToBeamer slideLevel) elts
243− return $ (Header lvl (ident,classes,[]) tit) : bs
243+ return $ (Header lvl (ident,classes,kvs) tit) : bs
244244 | otherwise = do -- lvl == slideLevel
245245 -- note: [fragile] is required or verbatim breaks
246246 let hasCodeBlock (CodeBlock _ _) = [True]
@@ -248,17 +248,20 @@ elementToBeamer slideLevel (Sec lvl _num (ident,classes,_) tit elts)
248248 let hasCode (Code _ _) = [True]
249249 hasCode _ = []
250250 opts <- gets stOptions
251− let fragile = if not $ null $ queryWith hasCodeBlock elts ++
251+ let fragile = not $ null $ queryWith hasCodeBlock elts ++
252252 if writerListings opts
253253 then queryWith hasCode elts
254254 else []
255− then "[fragile]"
256− else ""
257− let slideStart = Para $ RawInline "latex" ("\\begin{frame}" ++ fragile) :
255+ let allowframebreaks = "allowframebreaks" `elem` classes
256+ let optionslist = ["fragile" | fragile] ++
257+ ["allowframebreaks" | allowframebreaks]
258+ let options = if null optionslist
259+ then ""
260+ else "[" ++ intercalate "," optionslist ++ "]"
261+ let slideStart = Para $ RawInline "latex" ("\\begin{frame}" ++ options) :
258262 if tit == [Str "\0"] -- marker for hrule
259263 then []
260− else (RawInline "latex" "\\frametitle{") : tit ++
261− [RawInline "latex" "}"]
264+ else (RawInline "latex" "{") : tit ++ [RawInline "latex" "}"]
262265 let slideEnd = RawBlock "latex" "\\end{frame}"
263266 -- now carve up slide into blocks if there are sections inside
264267 bs <- concat `fmap` mapM (elementToBeamer slideLevel) elts