diff options
author | Jesse Rosenthal <jrosenthal@jhu.edu> | 2016-11-24 10:22:23 -0500 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2017-01-25 17:07:39 +0100 |
commit | 989971fce1066db17f104fb52bf64d990d3767ab (patch) | |
tree | 4ce0e6fc49c2c04f79dca45899cb831b7520d802 /src/Text | |
parent | a94f3dddee60360b8ba6a18ac2633fce2104cf02 (diff) | |
download | pandoc-989971fce1066db17f104fb52bf64d990d3767ab.tar.gz |
Pandoc.hs: Run `runIOorExplode` on IO functions.
This is a compatibility layer to reintroduce something like the old
errors into the functions.
Diffstat (limited to 'src/Text')
-rw-r--r-- | src/Text/Pandoc.hs | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/src/Text/Pandoc.hs b/src/Text/Pandoc.hs index d83fa85e7..703d0a002 100644 --- a/src/Text/Pandoc.hs +++ b/src/Text/Pandoc.hs @@ -180,6 +180,7 @@ import Text.Pandoc.Options import Text.Pandoc.Shared (safeRead, warn, mapLeft, pandocVersion) import Text.Pandoc.MediaBag (MediaBag) import Text.Pandoc.Error +import Text.Pandoc.Class (runIOorExplode) import Data.Aeson import qualified Data.ByteString.Lazy as BL import Data.List (intercalate) @@ -270,17 +271,23 @@ writers :: [ ( String, Writer ) ] writers = [ ("native" , PureStringWriter writeNative) ,("json" , PureStringWriter writeJSON) - ,("docx" , IOByteStringWriter writeDocx) - ,("odt" , IOByteStringWriter writeODT) - ,("epub" , IOByteStringWriter $ \o -> - writeEPUB o{ writerEpubVersion = Just EPUB2 }) - ,("epub3" , IOByteStringWriter $ \o -> - writeEPUB o{ writerEpubVersion = Just EPUB3 }) - ,("fb2" , IOStringWriter writeFB2) + ,("docx" , IOByteStringWriter $ \o doc -> + runIOorExplode $ writeDocx o doc) + ,("odt" , IOByteStringWriter $ \o doc -> + runIOorExplode $ writeODT o doc) + ,("epub" , IOByteStringWriter $ \o doc -> + runIOorExplode $ + writeEPUB o{ writerEpubVersion = Just EPUB2 } doc) + ,("epub3" , IOByteStringWriter $ \o doc -> + runIOorExplode $ + writeEPUB o{ writerEpubVersion = Just EPUB3 } doc) + ,("fb2" , IOStringWriter $ \o doc -> + runIOorExplode $ writeFB2 o doc) ,("html" , PureStringWriter writeHtmlString) ,("html5" , PureStringWriter $ \o -> writeHtmlString o{ writerHtml5 = True }) - ,("icml" , IOStringWriter writeICML) + ,("icml" , IOStringWriter $ \o doc -> + runIOorExplode $ writeICML o doc) ,("s5" , PureStringWriter $ \o -> writeHtmlString o{ writerSlideVariant = S5Slides , writerTableOfContents = False }) @@ -316,7 +323,8 @@ writers = [ ,("dokuwiki" , PureStringWriter writeDokuWiki) ,("zimwiki" , PureStringWriter writeZimWiki) ,("textile" , PureStringWriter writeTextile) - ,("rtf" , IOStringWriter writeRTFWithEmbeddedImages) + ,("rtf" , IOStringWriter $ \o doc -> + runIOorExplode $ writeRTFWithEmbeddedImages o doc) ,("org" , PureStringWriter writeOrg) ,("asciidoc" , PureStringWriter writeAsciiDoc) ,("haddock" , PureStringWriter writeHaddock) |