diff options
author | John MacFarlane <jgm@berkeley.edu> | 2014-08-08 21:04:25 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2014-08-08 21:05:34 -0700 |
commit | 19daf6cf0a336e0ffa08b2fb0e0c9932d6fef2a6 (patch) | |
tree | 88a1a41a891e9d86d1428937df87f52a3b89db42 /src/Text/Pandoc/Readers/EPUB.hs | |
parent | e1cc5479c07b400b6ed5efb1ef005ab53800601e (diff) |
Added `native_divs` and `native_spans` extensions.
This allows users to turn off the default pandoc behavior of
parsing contents of div and span tags in markdown and HTML
as native pandoc Div blocks and Span inlines.
Setting of default epub extensions has been moved from the EPUB
reader to Text.Pandoc.
Diffstat (limited to 'src/Text/Pandoc/Readers/EPUB.hs')
-rw-r--r-- | src/Text/Pandoc/Readers/EPUB.hs | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/src/Text/Pandoc/Readers/EPUB.hs b/src/Text/Pandoc/Readers/EPUB.hs index 968b815c0..7462b3711 100644 --- a/src/Text/Pandoc/Readers/EPUB.hs +++ b/src/Text/Pandoc/Readers/EPUB.hs @@ -13,8 +13,7 @@ import Text.Pandoc.Definition hiding (Attr) import Text.Pandoc.Walk (walk, query) import Text.Pandoc.Generic(bottomUp) import Text.Pandoc.Readers.HTML (readHtml) -import Text.Pandoc.Options ( ReaderOptions(..), readerExtensions, Extension(..) - , readerTrace) +import Text.Pandoc.Options ( ReaderOptions(..), readerTrace) import Text.Pandoc.Shared (escapeURI) import Text.Pandoc.MediaBag (MediaBag, insertMedia) import Text.Pandoc.Compat.Except (MonadError, throwError, runExcept, Except) @@ -32,7 +31,6 @@ import Data.Monoid (mempty, (<>)) import Data.List (isPrefixOf, isInfixOf) import Data.Maybe (mapMaybe, fromMaybe) import qualified Data.Map as M (Map, lookup, fromList, elems) -import qualified Data.Set as S (insert) import Control.DeepSeq.Generics (deepseq, NFData) import Debug.Trace (trace) @@ -65,9 +63,7 @@ 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} + 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,7 +74,7 @@ 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 |