@@ -37,7 +37,6 @@ import Text.Pandoc.Shared
37import Text.Pandoc.Parsing
37import Text.Pandoc.Parsing
38import Text.Pandoc.Options
38import Text.Pandoc.Options
39import Text.Pandoc.Error
39import Text.Pandoc.Error
40−import qualified Text.Pandoc.UTF8 as UTF8
41import Control.Monad ( when, liftM, guard, mzero )
40import Control.Monad ( when, liftM, guard, mzero )
42import Data.List ( findIndex, intercalate, isInfixOf,
41import Data.List ( findIndex, intercalate, isInfixOf,
43 transpose, sort, deleteFirstsBy, isSuffixOf , nub, union)
42 transpose, sort, deleteFirstsBy, isSuffixOf , nub, union)
@@ -49,8 +48,9 @@ import qualified Text.Pandoc.Builder as B
49import Data.Sequence (viewr, ViewR(..))
48import Data.Sequence (viewr, ViewR(..))
50import Data.Char (toLower, isHexDigit, isSpace)
49import Data.Char (toLower, isHexDigit, isSpace)
51import Data.Monoid ((<>))
50import Data.Monoid ((<>))
52−import Control.Monad.Except (throwError, catchError)
51+import Control.Monad.Except (throwError)
53−import Text.Pandoc.Class (PandocMonad, warning, readFileLazy, warningWithPos)
52+import Text.Pandoc.Class (PandocMonad, warning, readFileFromDirs,
55-- | Parse reStructuredText string and return Pandoc document.
55-- | Parse reStructuredText string and return Pandoc document.
56readRST :: PandocMonad m
56readRST :: PandocMonad m
@@ -421,12 +421,7 @@ include = try $ do
421 when (f `elem` containers) $
421 when (f `elem` containers) $
422 throwError $ PandocParseError $ "Include file loop at " ++ show oldPos
422 throwError $ PandocParseError $ "Include file loop at " ++ show oldPos
423 updateState $ \s -> s{ stateContainers = f : stateContainers s }
423 updateState $ \s -> s{ stateContainers = f : stateContainers s }
424− res <- readFileLazy' f
424+ contents <- readFileFromDirs ["."] f
425− contents <- case res of
428− warning $ "Could not read include file " ++ f ++ "."
430 let contentLines = lines contents
425 let contentLines = lines contents
431 let numLines = length contentLines
426 let numLines = length contentLines
432 let startLine' = case startLine of
427 let startLine' = case startLine of
@@ -470,9 +465,6 @@ include = try $ do
470 tail $ stateContainers s }
465 tail $ stateContainers s }
471 return bs
466 return bs
473−readFileLazy' :: PandocMonad m => FilePath -> m (Either PandocError String)
474−readFileLazy' f = catchError ((Right . UTF8.toStringLazy) <$> readFileLazy f) $
475− \(e :: PandocError) -> return (Left e)
478-- list blocks
470-- list blocks