aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Text/Pandoc/Free.hs13
-rw-r--r--src/Text/Pandoc/Writers/Docx.hs2
2 files changed, 2 insertions, 13 deletions
diff --git a/src/Text/Pandoc/Free.hs b/src/Text/Pandoc/Free.hs
index 071482e32..4294384d4 100644
--- a/src/Text/Pandoc/Free.hs
+++ b/src/Text/Pandoc/Free.hs
@@ -45,7 +45,6 @@ module Text.Pandoc.Free ( PandocActionF(..)
, getDefaultReferenceODT
, newStdGen
, newUniqueHash
- , readFileStrict
, readFileLazy
, readFileUTF8
, readDataFile
@@ -97,7 +96,6 @@ data PandocActionF nxt =
| GetDefaultReferenceODT (Maybe FilePath) (Archive -> nxt)
| NewStdGen (StdGen -> nxt)
| NewUniqueHash (Int -> nxt)
- | ReadFileStrict FilePath (B.ByteString -> nxt)
| ReadFileLazy FilePath (BL.ByteString -> nxt)
| ReadFileUTF8 FilePath (String -> nxt)
| ReadDataFile (Maybe FilePath) FilePath (B.ByteString -> nxt)
@@ -133,9 +131,6 @@ newStdGen = liftF $ NewStdGen id
newUniqueHash :: PandocAction Int
newUniqueHash = liftF $ NewUniqueHash id
-readFileStrict :: FilePath -> PandocAction B.ByteString
-readFileStrict fp = liftF $ ReadFileStrict fp id
-
readFileLazy :: FilePath -> PandocAction BL.ByteString
readFileLazy fp = liftF $ ReadFileLazy fp id
@@ -176,7 +171,6 @@ runIO (Free (GetDefaultReferenceODT mfp f)) =
IO.getDefaultReferenceODT mfp >>= runIO . f
runIO (Free (NewStdGen f)) = IO.newStdGen >>= runIO . f
runIO (Free (NewUniqueHash f)) = hashUnique <$> IO.newUnique >>= runIO . f
-runIO (Free (ReadFileStrict fp f)) = B.readFile fp >>= runIO . f
runIO (Free (ReadFileLazy fp f)) = BL.readFile fp >>= runIO . f
runIO (Free (ReadFileUTF8 fp f)) = UTF8.readFile fp >>= runIO . f
runIO (Free (ReadDataFile mfp fp f)) = IO.readDataFile mfp fp >>= runIO . f
@@ -242,11 +236,6 @@ runTest (Free (NewUniqueHash f)) = do
modify $ \st -> st { stUniqStore = us }
return u >>= runTest . f
_ -> M.fail "uniq store ran out of elements"
-runTest (Free (ReadFileStrict fp f)) = do
- fps <- asks envFiles
- case lookup fp fps of
- Just bs -> return bs >>= runTest . f
- Nothing -> error "openFile: does not exist"
runTest (Free (ReadFileLazy fp f)) = do
fps <- asks envFiles
case lookup fp fps of
@@ -269,7 +258,7 @@ runTest (Free (ReadDataFile Nothing "reference.odt" f)) = do
runTest . f
runTest (Free (ReadDataFile Nothing fname f)) = do
let fname' = if fname == "MANUAL.txt" then fname else "data" </> fname
- runTest (readFileStrict fname') >>= runTest . f
+ runTest (BL.toStrict <$> readFileLazy fname') >>= runTest . f
runTest (Free (ReadDataFile (Just userDir) fname f)) = do
userDirFiles <- asks envUserDataDir
case lookup (userDir </> fname) userDirFiles of
diff --git a/src/Text/Pandoc/Writers/Docx.hs b/src/Text/Pandoc/Writers/Docx.hs
index 3f380a3ee..07041f189 100644
--- a/src/Text/Pandoc/Writers/Docx.hs
+++ b/src/Text/Pandoc/Writers/Docx.hs
@@ -232,7 +232,7 @@ writeDocxPure opts doc@(Pandoc meta _) = do
utctime <- P.getCurrentTime
distArchive <- P.getDefaultReferenceDocx datadir
refArchive <- case writerReferenceDocx opts of
- Just f -> liftM (toArchive . toLazy) $ P.readFileStrict f
+ Just f -> toArchive <$> P.readFileLazy f
Nothing -> P.getDefaultReferenceDocx datadir
parsedDoc <- parseXml refArchive distArchive "word/document.xml"