@@ -70,7 +70,6 @@ import Data.Yaml (decode)
7070import qualified Data.Yaml as Yaml
7171import qualified Data.Text as T
7272import Control.Applicative ((<|>))
73−import Text.Pandoc.Readers.Txt2Tags (getT2TMeta)
7473import Paths_pandoc (getDataDir)
7574import Text.Printf (printf)
7675#ifndef _WINDOWS
@@ -78,8 +77,7 @@ import System.Posix.Terminal (queryTerminal)
7877import System.Posix.IO (stdOutput)
7978#endif
8079import Control.Monad.Trans
81−import Text.Pandoc.Class (runIOorExplode, PandocMonad, PandocIO)
82−import qualified Text.Pandoc.Class as P
80+import Text.Pandoc.Class (runIOorExplode, withMediaBag, PandocIO)
8381
8482type Transform = Pandoc -> Pandoc
8583
@@ -916,7 +914,7 @@ options =
916914 map ("--" ++) longs
917915 let allopts = unwords (concatMap optnames options)
918916 UTF8.hPutStrLn stdout $ printf tpl allopts
919− (unwords (map fst readers))
917+ (unwords (map fst (readers :: [(String, Reader PandocIO)])))
920918 (unwords (map fst (writers :: [(String, Writer PandocIO)])))
921919 (unwords $ map fst highlightingStyles)
922920 ddir
@@ -926,7 +924,7 @@ options =
926924 , Option "" ["list-input-formats"]
927925 (NoArg
928926 (\_ -> do
929− let readers'names = sort (map fst readers)
927+ let readers'names = sort (map fst (readers :: [(String, Reader PandocIO)]))
930928 mapM_ (UTF8.hPutStrLn stdout) readers'names
931929 exitSuccess ))
932930 ""
@@ -1410,13 +1408,16 @@ convertWithOpts opts args = do
14101408 else return . Right
14111409
14121410 let sourceToDoc :: [FilePath] -> IO (Pandoc, MediaBag)
1413− sourceToDoc sources' = fmap handleError $
1411+ sourceToDoc sources' =
14141412 case reader of
14151413 StringReader r-> do
14161414 srcs <- convertTabs . intercalate "\n" <$> readSources sources'
14171415 doc <- handleIncludes' srcs
1418− either (return . Left) (\s -> fmap (,mempty) <$> r readerOpts s) doc
1419− ByteStringReader r -> readFiles sources' >>= r readerOpts
1416+ case doc of
1417+ Right doc' -> runIOorExplode $ withMediaBag $ r readerOpts doc'
1418+ Left e -> error $ show e
1419+ ByteStringReader r -> readFiles sources' >>=
1420+ (\bs -> runIOorExplode $ withMediaBag $ r readerOpts bs)
14201421
14211422 -- We parse first if (1) fileScope is set, (2), it's a binary
14221423 -- reader, or (3) we're reading JSON. This is easier to do of an AND