Open simgt opened 6 years ago
I'm not sure how proper what I'm about to propose is, but it is where I got to from first principals.
Instead of being an option of the writeHtml5String
function, slide generation are now their own functions - one for each slide framework. The Hakyll pandocCompilerWith
calls PanDoc's writeHtml5String
function through a few intermediate functions. So, what I did was create a new function to call writeRevealJs
instead (the same should apply to the other slide writers).
...
import qualified Data.Text as T
import Text.Pandoc (Pandoc, runPure)
import Text.Pandoc.Writers.HTML (writeRevealJs)
...
writePandocSlideWith :: WriterOptions -> Item Pandoc -> Item String
writePandocSlideWith wopt (Item itemi doc) =
case runPure $ writeRevealJs wopt doc of
Left err -> error $ "writePandocSlidesWith: " ++ show err
Right item' -> Item itemi $ T.unpack item'
pandocCompileSlides :: ReaderOptions -> WriterOptions -> Compiler (Item String)
pandocCompileSlides ropt wopt =
cached "pandocCompileSlides" $
writePandocSlideWith wopt <$>
(traverse (return.id) =<< readPandocWith ropt =<< getResourceBody)
...
hakyll $ do
match "presentations/*" $ do
route $ setExtension "html"
compile $ pandocCompileSlides defaultHakyllReaderOptions defaultHakyllWriterOptions
>>= loadAndApplyTemplate "templates/presentation.html" defaultContext
>>= relativizeUrls
Note, you'll need a template setup that correctly sets up the presentation. The $body$
that is generated is just the slide content.
Hi,
I am trying to generate some DZSlides pages with Hakyll. Before the bump to Pandoc 2, I was using
both
writerHtml5
andwriterSlideVariant
have been removed fromWriterOptions
, see jgm/pandoc@91cdcc796df3db290d1930b159eb3ee2f74d4c03.What is the new proper way for doing this ?