aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2014-05-15 10:11:48 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2014-05-15 10:11:48 -0700
commitc5c9b0d2890699ee8fcdbb660662957f8efad319 (patch)
tree998d477ef523e76cf8efb7792d5a935bbfb113bb /src/Text/Pandoc
parent256390b3f9f535bd29105e73855a6220669a8193 (diff)
downloadpandoc-c5c9b0d2890699ee8fcdbb660662957f8efad319.tar.gz
EPUB writer: Fixed regression on cover image.
In 1.12.4 and 1.12.4.2, the cover image would not appear properly, because the metadata id was not correct. This was introduced by the fix to #1254. Now we derive the id from the actual cover image filename, which we preserve rather than using "cover-image."
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r--src/Text/Pandoc/Writers/EPUB.hs10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/Text/Pandoc/Writers/EPUB.hs b/src/Text/Pandoc/Writers/EPUB.hs
index 893ec3be9..4d2a39846 100644
--- a/src/Text/Pandoc/Writers/EPUB.hs
+++ b/src/Text/Pandoc/Writers/EPUB.hs
@@ -333,7 +333,7 @@ writeEPUB opts doc@(Pandoc meta _) = do
case epubCoverImage metadata of
Nothing -> return ([],[])
Just img -> do
- let coverImage = "cover-image" ++ takeExtension img
+ let coverImage = "media/" ++ takeFileName img
let cpContent = renderHtml $ writeHtml opts'
(Pandoc meta [RawBlock (Format "html") $ "<div id=\"cover-image\">\n<img src=\"" ++ coverImage ++ "\" alt=\"cover image\" />\n</div>"])
imgContent <- B.readFile img
@@ -561,8 +561,8 @@ writeEPUB opts doc@(Pandoc meta _) = do
,("content", "0")] $ ()
] ++ case epubCoverImage metadata of
Nothing -> []
- Just _ -> [unode "meta" ! [("name","cover"),
- ("content","cover-image")] $ ()]
+ Just img -> [unode "meta" ! [("name","cover"),
+ ("content", toId img)] $ ()]
, unode "docTitle" $ unode "text" $ plainTitle
, unode "navMap" $
tpNode : evalState (mapM (navPointNode navMapFormatter) secs) 1
@@ -657,8 +657,8 @@ metadataElement version md currentTime =
coverageNodes = maybe [] (dcTag' "coverage") $ epubCoverage md
rightsNodes = maybe [] (dcTag' "rights") $ epubRights md
coverImageNodes = maybe []
- (const $ [unode "meta" ! [("name","cover"),
- ("content","cover-image")] $ ()])
+ (\img -> [unode "meta" ! [("name","cover"),
+ ("content",toId img)] $ ()])
$ epubCoverImage md
modifiedNodes = [ unode "meta" ! [("property", "dcterms:modified")] $
(showDateTimeISO8601 currentTime) | version == EPUB3 ]