@@ -13,8 +13,8 @@ import Text.Pandoc.Writers.Native (writeNative)
1313import qualified Data.Map as M
1414import Text.Pandoc.MediaBag (MediaBag, lookupMedia, mediaDirectory)
1515import Codec.Archive.Zip
16−import Text.Pandoc.Error
1716import Text.Pandoc.Class (runIOorExplode)
17+import qualified Text.Pandoc.Class as P
1818
1919-- We define a wrapper around pandoc that doesn't normalize in the
2020-- tests. Since we do our own normalization, we want to make sure
@@ -43,9 +43,9 @@ compareOutput :: ReaderOptions
4343compareOutput opts docxFile nativeFile = do
4444 df <- B.readFile docxFile
4545 nf <- Prelude.readFile nativeFile
46− let (p, _) = handleError $ readDocx opts df
46+ p <- runIOorExplode $ readDocx opts df
4747 df' <- runIOorExplode $ readNative nf
48− return $ (noNorm p, noNorm $ handleError df')
48+ return $ (noNorm p, noNorm df')
4949
5050testCompareWithOptsIO :: ReaderOptions -> String -> FilePath -> FilePath -> IO Test
5151testCompareWithOptsIO opts name docxFile nativeFile = do
@@ -62,7 +62,7 @@ testCompare = testCompareWithOpts def
6262testForWarningsWithOptsIO :: ReaderOptions -> String -> FilePath -> [String] -> IO Test
6363testForWarningsWithOptsIO opts name docxFile expected = do
6464 df <- B.readFile docxFile
65− let (_, _, warns) = handleError $ readDocxWithWarnings opts df
65+ warns <- runIOorExplode (readDocx opts df >> P.getWarnings)
6666 return $ test id name (unlines warns, unlines expected)
6767
6868testForWarningsWithOpts :: ReaderOptions -> String -> FilePath -> [String] -> Test
@@ -95,7 +95,7 @@ compareMediaPathIO mediaPath mediaBag docxPath = do
9595compareMediaBagIO :: FilePath -> IO Bool
9696compareMediaBagIO docxFile = do
9797 df <- B.readFile docxFile
98− let (_, mb) = handleError $ readDocx def df
98+ mb <- runIOorExplode (readDocx def df >> P.getMediaBag)
9999 bools <- mapM
100100 (\(fp, _, _) -> compareMediaPathIO fp mb docxFile)
101101 (mediaDirectory mb)