aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2014-08-09 17:08:43 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2014-08-09 17:08:43 -0700
commitc2a0d47c7b15483efa565ab2b6d9fa836e3a8818 (patch)
treea2631dd6b1d7d6cdbcab866e07e9300dbf3fe488
parent1ea92c3e234315d2191a313ef817cd7215a6a206 (diff)
parent4ae61bdf8fb35ab82ef9fffe05817bb4323fde45 (diff)
downloadpandoc-c2a0d47c7b15483efa565ab2b6d9fa836e3a8818.tar.gz
Merge pull request #1508 from mpickering/master
EPUB: Fixed another mediabag related regression..
-rw-r--r--src/Text/Pandoc/Readers/EPUB.hs8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/Text/Pandoc/Readers/EPUB.hs b/src/Text/Pandoc/Readers/EPUB.hs
index fd5980f0a..cb5f684b2 100644
--- a/src/Text/Pandoc/Readers/EPUB.hs
+++ b/src/Text/Pandoc/Readers/EPUB.hs
@@ -62,7 +62,7 @@ archiveToEPUB 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) archive ast
+ let mediaBag = fetchImages (M.elems items) root archive ast
return $ (ast, mediaBag)
where
os' = os {readerParseRaw = True}
@@ -86,16 +86,18 @@ archiveToEPUB os archive = do
-- paths should be absolute when this function is called
-- renameImages should do this
fetchImages :: [(FilePath, MIME)]
+ -> FilePath -- ^ Root
-> Archive
-> Pandoc
-> MediaBag
-fetchImages mimes arc (query iq -> links) =
+fetchImages mimes root arc (query iq -> links) =
foldr (uncurry3 insertMedia) mempty
(mapMaybe getEntry links)
where
getEntry link =
+ let abslink = root </> link in
(link , lookup link mimes, ) . fromEntry
- <$> findEntryByPath link arc
+ <$> findEntryByPath abslink arc
iq :: Inline -> [FilePath]
iq (Image _ (url, _)) = [url]