Source

Pandoc filters / beamer.hs

-- A Pandoc filter to make beamer presentations
-- Matti Pastell 2011 <matti.pastell@helsinki.fi> 
-- Requires Pandoc 1.8

import Text.Pandoc
import Text.Pandoc.Shared


main = interact $ jsonFilter $ bottomUp beamer

beamer :: Block -> Block
beamer (Header 1 text) = RawBlock "latex" 
       (concat ["\\end{frame}\n\n\\begin{frame}{",
                (stringify text), "}\n"])
beamer (Para [Image xs (u, t)]) = RawBlock "latex" ("\\centerline{\\includegraphics[width=0.8\\textheight]{" ++ u ++ "}}\n")
beamer x=x