git.iko.soy/typeable/pandoc
on master help sign in
PDF: Refactoring, makePDF is now in PandocIO [API change].
commit5c44fd554fbebc2e01a0aa9f569468789f353bf4 authorJohn MacFarlane <jgm@berkeley.edu> dateSat 20 May 2017, 22:42 (9 years ago) parentfd6e65b
1 file changed+8−13
src/Text/Pandoc/PDF.hs+8−13
src/Text/Pandoc/PDF.hs+8−13
@@ -72,16 +72,15 @@ changePathSeparators :: FilePath -> FilePath
7272changePathSeparators = intercalate "/" . splitDirectories
7373#endif
7474
75−makePDF :: MonadIO m
76− => String -- ^ pdf creator (pdflatex, lualatex,
75+makePDF :: String -- ^ pdf creator (pdflatex, lualatex,
7776 -- xelatex, context, wkhtmltopdf, pdfroff)
7877 -> (WriterOptions -> Pandoc -> PandocIO String) -- ^ writer
7978 -> WriterOptions -- ^ options
8079 -> Verbosity -- ^ verbosity level
8180 -> MediaBag -- ^ media
8281 -> Pandoc -- ^ document
83− -> m (Either ByteString ByteString)
84−makePDF "wkhtmltopdf" writer opts verbosity _ doc@(Pandoc meta _) = liftIO $ do
82+ -> PandocIO (Either ByteString ByteString)
83+makePDF "wkhtmltopdf" writer opts verbosity _ doc@(Pandoc meta _) = do
8584 let mathArgs = case writerHTMLMathMethod opts of
8685 -- with MathJax, wait til all math is rendered:
8786 MathJax _ -> ["--run-script", "MathJax.Hub.Register.StartupHook('End Typeset', function() { window.status = 'mathjax_loaded' });",
@@ -102,17 +101,13 @@ makePDF "wkhtmltopdf" writer opts verbosity _ doc@(Pandoc meta _) = liftIO $ do
102101 ,("margin-left", fromMaybe (Just "1.25in")
103102 (getField "margin-left" meta'))
104103 ]
105− source <- runIOorExplode $ do
106− setVerbosity verbosity
107− writer opts doc
108− html2pdf verbosity args source
109−makePDF "pdfroff" writer opts verbosity _mediabag doc = liftIO $ do
110− source <- runIOorExplode $ do
111− setVerbosity verbosity
112− writer opts doc
104+ source <- writer opts doc
105+ liftIO $ html2pdf verbosity args source
106+makePDF "pdfroff" writer opts verbosity _mediabag doc = do
107+ source <- writer opts doc
113108 let args = ["-ms", "-mpdfmark", "-e", "-t", "-k", "-KUTF-8", "-i",
114109 "--no-toc-relocation"]
115− ms2pdf verbosity args source
110+ liftIO $ ms2pdf verbosity args source
116111makePDF program writer opts verbosity mediabag doc = do
117112 let withTemp = if takeBaseName program == "context"
118113 then withTempDirectory "."