diff options
author | John MacFarlane <jgm@berkeley.edu> | 2014-08-09 15:38:03 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2014-08-09 15:38:03 -0700 |
commit | 1ea92c3e234315d2191a313ef817cd7215a6a206 (patch) | |
tree | 3059f80bcaff24910b166073c9721d1d63b870c7 /src | |
parent | 4983083079a6d5095e006a81997d8bc1ddbf1d8e (diff) | |
parent | d0fbe5b75142cc30d925af9f8e891e2a0a120b19 (diff) | |
download | pandoc-1ea92c3e234315d2191a313ef817cd7215a6a206.tar.gz |
Merge pull request #1507 from mpickering/master
Images are now relative to manifest file.
Diffstat (limited to 'src')
-rw-r--r-- | src/Text/Pandoc/Readers/EPUB.hs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/Text/Pandoc/Readers/EPUB.hs b/src/Text/Pandoc/Readers/EPUB.hs index b6b271488..fd5980f0a 100644 --- a/src/Text/Pandoc/Readers/EPUB.hs +++ b/src/Text/Pandoc/Readers/EPUB.hs @@ -55,7 +55,7 @@ archiveToEPUB os archive = do meta <- parseMeta content (cover, items) <- parseManifest content -- No need to collapse here as the image path is from the manifest file - let coverDoc = fromMaybe mempty (imageToPandoc . (root </>) <$> cover) + let coverDoc = fromMaybe mempty (imageToPandoc <$> cover) spine <- parseSpine items content let escapedSpine = map (escapeURI . takeFileName . fst) spine Pandoc _ bs <- @@ -69,17 +69,17 @@ archiveToEPUB os archive = do parseSpineElem :: MonadError String m => FilePath -> (FilePath, MIME) -> m Pandoc parseSpineElem (normalise -> r) (normalise -> path, mime) = do when (readerTrace os) (traceM path) - doc <- mimeToReader mime (r </> path) + doc <- mimeToReader mime r path let docSpan = B.doc $ B.para $ B.spanWith (takeFileName path, [], []) mempty return $ docSpan <> doc - mimeToReader :: MonadError String m => MIME -> FilePath -> m Pandoc - mimeToReader "application/xhtml+xml" (normalise -> path) = do - fname <- findEntryByPathE path archive + mimeToReader :: MonadError String m => MIME -> FilePath -> FilePath -> m Pandoc + mimeToReader "application/xhtml+xml" (normalise -> root) (normalise -> path) = do + fname <- findEntryByPathE (root </> path) archive return $ fixInternalReferences path . readHtml os' . UTF8.toStringLazy $ fromEntry fname - mimeToReader s path + mimeToReader s _ path | s `elem` imageMimes = return $ imageToPandoc path | otherwise = return $ mempty |