aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Writers
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2017-09-30 16:07:47 -0500
committerJohn MacFarlane <jgm@berkeley.edu>2017-09-30 16:11:20 -0500
commitf3a80034fff41a8b0c13519fa13bed794db1b8d2 (patch)
tree8355bd3c88b87b960171a65aad05b36e6822e8a4 /src/Text/Pandoc/Writers
parent9b7d652ab7a0f4cdd86efd92f43f1b20724e8982 (diff)
downloadpandoc-f3a80034fff41a8b0c13519fa13bed794db1b8d2.tar.gz
Removed writerSourceURL, add source URL to common state.
Removed `writerSourceURL` from `WriterOptions` (API change). Added `stSourceURL` to `CommonState`. It is set automatically by `setInputFiles`. Text.Pandoc.Class now exports `setInputFiles`, `setOutputFile`. The type of `getInputFiles` has changed; it now returns `[FilePath]` instead of `Maybe [FilePath]`. Functions in Class that formerly took the source URL as a parameter now have one fewer parameter (`fetchItem`, `downloadOrRead`, `setMediaResource`, `fillMediaBag`). Removed `WriterOptions` parameter from `makeSelfContained` in `SelfContained`.
Diffstat (limited to 'src/Text/Pandoc/Writers')
-rw-r--r--src/Text/Pandoc/Writers/Docx.hs2
-rw-r--r--src/Text/Pandoc/Writers/EPUB.hs2
-rw-r--r--src/Text/Pandoc/Writers/FB2.hs2
-rw-r--r--src/Text/Pandoc/Writers/ICML.hs2
-rw-r--r--src/Text/Pandoc/Writers/ODT.hs2
-rw-r--r--src/Text/Pandoc/Writers/RTF.hs2
6 files changed, 6 insertions, 6 deletions
diff --git a/src/Text/Pandoc/Writers/Docx.hs b/src/Text/Pandoc/Writers/Docx.hs
index 3d6eb9fe5..6102d97ed 100644
--- a/src/Text/Pandoc/Writers/Docx.hs
+++ b/src/Text/Pandoc/Writers/Docx.hs
@@ -1295,7 +1295,7 @@ inlineToOpenXML' opts (Image attr alt (src, title)) = do
Just (_,_,_,elt,_) -> return [elt]
Nothing -> do
catchError
- (do (img, mt) <- P.fetchItem (writerSourceURL opts) src
+ (do (img, mt) <- P.fetchItem src
ident <- ("rId"++) `fmap` ((lift . lift) getUniqueId)
let (xpt,ypt) = desiredSizeInPoints opts attr
(either (const def) id (imageSize opts img))
diff --git a/src/Text/Pandoc/Writers/EPUB.hs b/src/Text/Pandoc/Writers/EPUB.hs
index 04126fbb7..6bae65b6b 100644
--- a/src/Text/Pandoc/Writers/EPUB.hs
+++ b/src/Text/Pandoc/Writers/EPUB.hs
@@ -918,7 +918,7 @@ modifyMediaRef opts oldsrc = do
case lookup oldsrc media of
Just (n,_) -> return n
Nothing -> catchError
- (do (img, mbMime) <- P.fetchItem (writerSourceURL opts) oldsrc
+ (do (img, mbMime) <- P.fetchItem oldsrc
let new = "media/file" ++ show (length media) ++
fromMaybe (takeExtension (takeWhile (/='?') oldsrc))
(('.':) <$> (mbMime >>= extensionFromMimeType))
diff --git a/src/Text/Pandoc/Writers/FB2.hs b/src/Text/Pandoc/Writers/FB2.hs
index 4c764d987..36c572b63 100644
--- a/src/Text/Pandoc/Writers/FB2.hs
+++ b/src/Text/Pandoc/Writers/FB2.hs
@@ -255,7 +255,7 @@ fetchImage href link = do
else return Nothing
(True, Just _) -> return Nothing -- not base64-encoded
_ -> do
- catchError (do (bs, mbmime) <- P.fetchItem Nothing link
+ catchError (do (bs, mbmime) <- P.fetchItem link
case mbmime of
Nothing -> do
report $ CouldNotDetermineMimeType link
diff --git a/src/Text/Pandoc/Writers/ICML.hs b/src/Text/Pandoc/Writers/ICML.hs
index 37df58e65..650a1c012 100644
--- a/src/Text/Pandoc/Writers/ICML.hs
+++ b/src/Text/Pandoc/Writers/ICML.hs
@@ -543,7 +543,7 @@ styleToStrAttr style =
imageICML :: PandocMonad m => WriterOptions -> Style -> Attr -> Target -> WS m Doc
imageICML opts style attr (src, _) = do
imgS <- catchError
- (do (img, _) <- P.fetchItem (writerSourceURL opts) src
+ (do (img, _) <- P.fetchItem src
case imageSize opts img of
Right size -> return size
Left msg -> do
diff --git a/src/Text/Pandoc/Writers/ODT.hs b/src/Text/Pandoc/Writers/ODT.hs
index 4c74ef469..90b7c3501 100644
--- a/src/Text/Pandoc/Writers/ODT.hs
+++ b/src/Text/Pandoc/Writers/ODT.hs
@@ -180,7 +180,7 @@ addLang lang = everywhere' (mkT updateLangAttr)
-- | transform both Image and Math elements
transformPicMath :: PandocMonad m => WriterOptions ->Inline -> O m Inline
transformPicMath opts (Image attr@(id', cls, _) lab (src,t)) = catchError
- (do (img, mbMimeType) <- P.fetchItem (writerSourceURL opts) src
+ (do (img, mbMimeType) <- P.fetchItem src
(ptX, ptY) <- case imageSize opts img of
Right s -> return $ sizeInPoints s
Left msg -> do
diff --git a/src/Text/Pandoc/Writers/RTF.hs b/src/Text/Pandoc/Writers/RTF.hs
index 48d31c7bf..d4de3112c 100644
--- a/src/Text/Pandoc/Writers/RTF.hs
+++ b/src/Text/Pandoc/Writers/RTF.hs
@@ -56,7 +56,7 @@ import Text.Printf (printf)
-- If file not found or filetype not jpeg or png, leave the inline unchanged.
rtfEmbedImage :: PandocMonad m => WriterOptions -> Inline -> m Inline
rtfEmbedImage opts x@(Image attr _ (src,_)) = catchError
- (do result <- P.fetchItem (writerSourceURL opts) src
+ (do result <- P.fetchItem src
case result of
(imgdata, Just mime)
| mime == "image/jpeg" || mime == "image/png" -> do