@@ -134,7 +134,7 @@ writeEPUB mbStylesheet opts doc@(Pandoc meta _) = do
134 ,("xmlns","http://www.idpf.org/2007/opf")
134 ,("xmlns","http://www.idpf.org/2007/opf")
135 ,("unique-identifier","BookId")] $
135 ,("unique-identifier","BookId")] $
136 [ metadataElement (writerEPUBMetadata opts')
136 [ metadataElement (writerEPUBMetadata opts')
137− uuid lang plainTitle plainAuthors
137+ uuid lang plainTitle plainAuthors mbCoverImage
138 , unode "manifest" $
138 , unode "manifest" $
139 [ unode "item" ! [("id","ncx"), ("href","toc.ncx")
139 [ unode "item" ! [("id","ncx"), ("href","toc.ncx")
140 ,("media-type","application/x-dtbncx+xml")] $ ()
140 ,("media-type","application/x-dtbncx+xml")] $ ()
@@ -209,8 +209,8 @@ writeEPUB mbStylesheet opts doc@(Pandoc meta _) = do
209 (picEntries ++ cpicEntry ++ cpgEntry ++ chapterEntries) )
209 (picEntries ++ cpicEntry ++ cpgEntry ++ chapterEntries) )
210 return $ fromArchive archive
210 return $ fromArchive archive
212−metadataElement :: String -> UUID -> String -> String -> [String] -> Element
212+metadataElement :: String -> UUID -> String -> String -> [String] -> Maybe a -> Element
213−metadataElement metadataXML uuid lang title authors =
213+metadataElement metadataXML uuid lang title authors mbCoverImage =
214 let userNodes = parseXML metadataXML
214 let userNodes = parseXML metadataXML
215 elt = unode "metadata" ! [("xmlns:dc","http://purl.org/dc/elements/1.1/")
215 elt = unode "metadata" ! [("xmlns:dc","http://purl.org/dc/elements/1.1/")
216 ,("xmlns:opf","http://www.idpf.org/2007/opf")] $
216 ,("xmlns:opf","http://www.idpf.org/2007/opf")] $
@@ -225,7 +225,9 @@ metadataElement metadataXML uuid lang title authors =
225 [ unode "dc:language" lang | not (elt `contains` "language") ] ++
225 [ unode "dc:language" lang | not (elt `contains` "language") ] ++
226 [ unode "dc:identifier" ! [("id","BookId")] $ show uuid |
226 [ unode "dc:identifier" ! [("id","BookId")] $ show uuid |
227 not (elt `contains` "identifier") ] ++
227 not (elt `contains` "identifier") ] ++
228− [ unode "dc:creator" ! [("opf:role","aut")] $ a | a <- authors ]
228+ [ unode "dc:creator" ! [("opf:role","aut")] $ a | a <- authors ] ++
229+ [ unode "meta" ! [("name","cover"), ("content","cover-image")] $ () |
230+ not (isNothing mbCoverImage) ]
229 in elt{ elContent = elContent elt ++ map Elem newNodes }
231 in elt{ elContent = elContent elt ++ map Elem newNodes }
231transformInlines :: HTMLMathMethod
233transformInlines :: HTMLMathMethod