diff options
author | Matthew Pickering <matthewtpickering@gmail.com> | 2014-08-08 19:58:23 +0100 |
---|---|---|
committer | Matthew Pickering <matthewtpickering@gmail.com> | 2014-08-08 22:31:02 +0100 |
commit | 116f03a70a8525565850f2779af2b6b348676267 (patch) | |
tree | bf4d027ea60f4357cba6f033b38657ff1a88f449 | |
parent | aae90a8671d4fdb46ede2669e6713a559b9d3fbb (diff) | |
download | pandoc-116f03a70a8525565850f2779af2b6b348676267.tar.gz |
EPUB Reader: Removed incorrectly set reader flag
-rw-r--r-- | src/Text/Pandoc/Readers/EPUB.hs | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/Text/Pandoc/Readers/EPUB.hs b/src/Text/Pandoc/Readers/EPUB.hs index 968b815c0..8d6f322bf 100644 --- a/src/Text/Pandoc/Readers/EPUB.hs +++ b/src/Text/Pandoc/Readers/EPUB.hs @@ -51,7 +51,7 @@ runEPUB = either error id . runExcept -- are of the form "filename#id" -- archiveToEPUB :: (MonadError String m) => ReaderOptions -> Archive -> m (Pandoc, MediaBag) -archiveToEPUB os archive = do +archiveToEPUB (setEPUBOptions -> os) archive = do (root, content) <- getManifest archive meta <- parseMeta content (cover, items) <- parseManifest content @@ -65,9 +65,6 @@ archiveToEPUB os archive = do let mediaBag = fetchImages (M.elems items) root archive ast return $ (ast, mediaBag) where - rs = readerExtensions os - os' = os {readerExtensions = foldr S.insert rs [Ext_epub_html_exts, Ext_raw_html]} - os'' = os' {readerParseRaw = True} parseSpineElem :: MonadError String m => FilePath -> (FilePath, MIME) -> m Pandoc parseSpineElem (normalise -> r) (normalise -> path, mime) = do when (readerTrace os) (traceM path) @@ -78,13 +75,20 @@ archiveToEPUB os archive = do mimeToReader "application/xhtml+xml" r path = do fname <- findEntryByPathE (r </> path) archive return $ fixInternalReferences (r </> path) . - readHtml os'' . + readHtml os . UTF8.toStringLazy $ fromEntry fname mimeToReader s _ path | s `elem` imageMimes = return $ imageToPandoc path | otherwise = return $ mempty +setEPUBOptions :: ReaderOptions -> ReaderOptions +setEPUBOptions os = os'' + where + rs = readerExtensions os + os' = os {readerExtensions = foldr S.insert rs [Ext_epub_html_exts]} + os'' = os' {readerParseRaw = True} + fetchImages :: [(FilePath, MIME)] -> FilePath -> Archive |