git.iko.soy/typeable/pandoc
on master help sign in
Handle the case where the "cover" meta does not link to the manifest
commit43347888d5cbc16c83e7465d98b73e402d7ab1da authorblmage <bl.mage.fr@gmail.com> dateMon 17 Jun 2019, 07:37 (7 years ago) parentefe318b
1 file changed+2−2
src/Text/Pandoc/Readers/EPUB.hs+2−2
src/Text/Pandoc/Readers/EPUB.hs+2−2
@@ -21,7 +21,7 @@ import Prelude
2121import Codec.Archive.Zip (Archive (..), Entry, findEntryByPath, fromEntry,
2222 toArchiveOrFail)
2323import Control.DeepSeq (NFData, deepseq)
24−import Control.Monad (guard, liftM, liftM2)
24+import Control.Monad (guard, liftM, liftM2, mplus)
2525import Control.Monad.Except (throwError)
2626import qualified Data.ByteString.Lazy as BL (ByteString)
2727import Data.List (isInfixOf, isPrefixOf)
@@ -134,7 +134,7 @@ parseManifest content coverId = do
134134 let items = findChildren (dfName "item") manifest
135135 r <- mapM parseItem items
136136 let cover = findAttr (emptyName "href") =<< filterChild findCover manifest
137− return (cover, M.fromList r)
137+ return (cover `mplus` coverId, M.fromList r)
138138 where
139139 findCover e = maybe False (isInfixOf "cover-image")
140140 (findAttr (emptyName "properties") e)