aboutsummaryrefslogtreecommitdiff
path: root/src/Text
diff options
context:
space:
mode:
authorblmage <bl.mage.fr@gmail.com>2019-06-17 07:37:01 +0200
committerblmage <bl.mage.fr@gmail.com>2019-06-18 19:09:53 +0200
commit43347888d5cbc16c83e7465d98b73e402d7ab1da (patch)
treeb44ff0b237253edee5010927db76e52cf761e9c0 /src/Text
parentefe318b3f68443b8d024ce2c1922654003482234 (diff)
downloadpandoc-43347888d5cbc16c83e7465d98b73e402d7ab1da.tar.gz
Handle the case where the "cover" meta does not link to the manifest
Diffstat (limited to 'src/Text')
-rw-r--r--src/Text/Pandoc/Readers/EPUB.hs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Readers/EPUB.hs b/src/Text/Pandoc/Readers/EPUB.hs
index 8958a92a3..8e9746090 100644
--- a/src/Text/Pandoc/Readers/EPUB.hs
+++ b/src/Text/Pandoc/Readers/EPUB.hs
@@ -21,7 +21,7 @@ import Prelude
import Codec.Archive.Zip (Archive (..), Entry, findEntryByPath, fromEntry,
toArchiveOrFail)
import Control.DeepSeq (NFData, deepseq)
-import Control.Monad (guard, liftM, liftM2)
+import Control.Monad (guard, liftM, liftM2, mplus)
import Control.Monad.Except (throwError)
import qualified Data.ByteString.Lazy as BL (ByteString)
import Data.List (isInfixOf, isPrefixOf)
@@ -134,7 +134,7 @@ parseManifest content coverId = do
let items = findChildren (dfName "item") manifest
r <- mapM parseItem items
let cover = findAttr (emptyName "href") =<< filterChild findCover manifest
- return (cover, M.fromList r)
+ return (cover `mplus` coverId, M.fromList r)
where
findCover e = maybe False (isInfixOf "cover-image")
(findAttr (emptyName "properties") e)