aboutsummaryrefslogtreecommitdiff
path: root/src/Text
diff options
context:
space:
mode:
Diffstat (limited to 'src/Text')
-rw-r--r--src/Text/Pandoc/Readers/EPUB.hs14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/Text/Pandoc/Readers/EPUB.hs b/src/Text/Pandoc/Readers/EPUB.hs
index c17f00989..2967bd09a 100644
--- a/src/Text/Pandoc/Readers/EPUB.hs
+++ b/src/Text/Pandoc/Readers/EPUB.hs
@@ -62,7 +62,7 @@ archiveToEPUB (setEPUBOptions -> os) archive = do
foldM' (\a b -> ((a <>) . bottomUp (prependHash escapedSpine))
`liftM` parseSpineElem root b) mempty spine
let ast = coverDoc <> (Pandoc meta bs)
- let mediaBag = fetchImages (M.elems items) root archive ast
+ let mediaBag = fetchImages (M.elems items) archive ast
return $ (ast, mediaBag)
where
parseSpineElem :: MonadError String m => FilePath -> (FilePath, MIME) -> m Pandoc
@@ -89,19 +89,19 @@ setEPUBOptions os = os''
os' = os {readerExtensions = foldr S.insert rs [Ext_epub_html_exts]}
os'' = os' {readerParseRaw = True}
+-- paths should be absolute when this function is called
+-- renameImages should do this
fetchImages :: [(FilePath, MIME)]
- -> FilePath
-> Archive
-> Pandoc
-> MediaBag
-fetchImages mimes root arc (query iq -> links) =
+fetchImages mimes arc (query iq -> links) =
foldr (uncurry3 insertMedia) mempty
(mapMaybe getEntry links)
where
- getEntry (normalise -> l) =
- let mediaPos = normalise (root </> l) in
- (l , lookup mediaPos mimes, ) . fromEntry
- <$> findEntryByPath mediaPos arc
+ getEntry link =
+ (link , lookup link mimes, ) . fromEntry
+ <$> findEntryByPath link arc
iq :: Inline -> [FilePath]
iq (Image _ (url, _)) = [url]