summaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Writers/RTF.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Text/Pandoc/Writers/RTF.hs')
-rw-r--r--src/Text/Pandoc/Writers/RTF.hs4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Writers/RTF.hs b/src/Text/Pandoc/Writers/RTF.hs
index 4e7c2a7cd..91df240af 100644
--- a/src/Text/Pandoc/Writers/RTF.hs
+++ b/src/Text/Pandoc/Writers/RTF.hs
@@ -27,6 +27,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Conversion of 'Pandoc' documents to RTF (rich text format).
-}
+{-# LANGUAGE ScopedTypeVariables #-}
module Text.Pandoc.Writers.RTF ( writeRTF, rtfEmbedImage ) where
import Text.Pandoc.Definition
import Text.Pandoc.Shared
@@ -38,6 +39,7 @@ import System.FilePath ( takeExtension )
import qualified Data.ByteString as B
import Text.Printf ( printf )
import Network.URI ( isAbsoluteURI, unEscapeString )
+import qualified Control.Exception as E (catch, IOException)
-- | Convert Image inlines into a raw RTF embedded image, read from a file.
-- If file not found or filetype not jpeg or png, leave the inline unchanged.
@@ -47,7 +49,7 @@ rtfEmbedImage x@(Image _ (src,_)) = do
if ext `elem` [".jpg",".jpeg",".png"] && not (isAbsoluteURI src)
then do
let src' = unEscapeString src
- imgdata <- catch (B.readFile src') (\_ -> return B.empty)
+ imgdata <- E.catch (B.readFile src') (\(_::E.IOException) -> return B.empty)
let bytes = map (printf "%02x") $ B.unpack imgdata
let filetype = case ext of
".jpg" -> "\\jpegblip"