git.iko.soy/typeable/pandoc
on master help sign in
PDF: Modified for new image size attributes parameter.
12df405John MacFarlane
src/Text/Pandoc/PDF.hs+6−6
@@ -84,10 +84,10 @@ handleImage' :: WriterOptions
84 -> FilePath
84 -> FilePath
85 -> Inline
85 -> Inline
86 -> IO Inline
86 -> IO Inline
87−handleImage' opts tmpdir (Image ils (src,tit)) = do
87+handleImage' opts tmpdir (Image attr ils (src,tit)) = do
88 exists <- doesFileExist src
88 exists <- doesFileExist src
89 if exists
89 if exists
90− then return $ Image ils (src,tit)
90+ then return $ Image attr ils (src,tit)
91 else do
91 else do
92 res <- fetchItem' (writerMediaBag opts) (writerSourceURL opts) src
92 res <- fetchItem' (writerMediaBag opts) (writerSourceURL opts) src
93 case res of
93 case res of
@@ -97,20 +97,20 @@ handleImage' opts tmpdir (Image ils (src,tit)) = do
97 let basename = showDigest $ sha1 $ BL.fromChunks [contents]
97 let basename = showDigest $ sha1 $ BL.fromChunks [contents]
98 let fname = tmpdir </> basename <.> ext
98 let fname = tmpdir </> basename <.> ext
99 BS.writeFile fname contents
99 BS.writeFile fname contents
100− return $ Image ils (fname,tit)
100+ return $ Image attr ils (fname,tit)
101 _ -> do
101 _ -> do
102 warn $ "Could not find image `" ++ src ++ "', skipping..."
102 warn $ "Could not find image `" ++ src ++ "', skipping..."
103− return $ Image ils (src,tit)
103+ return $ Image attr ils (src,tit)
104handleImage' _ _ x = return x
104handleImage' _ _ x = return x
105
105
106convertImages :: FilePath -> Inline -> IO Inline
106convertImages :: FilePath -> Inline -> IO Inline
107−convertImages tmpdir (Image ils (src, tit)) = do
107+convertImages tmpdir (Image attr ils (src, tit)) = do
108 img <- convertImage tmpdir src
108 img <- convertImage tmpdir src
109 newPath <-
109 newPath <-
110 case img of
110 case img of
111 Left e -> src <$ warn e
111 Left e -> src <$ warn e
112 Right fp -> return fp
112 Right fp -> return fp
113− return (Image ils (newPath, tit))
113+ return (Image attr ils (newPath, tit))
114convertImages _ x = return x
114convertImages _ x = return x
115
115
116-- Convert formats which do not work well in pdf to png
116-- Convert formats which do not work well in pdf to png