@@ -977,14 +977,18 @@ readTeXFile f = do
977 readFileFromDirs (splitBy (==':') texinputs) f
977 readFileFromDirs (splitBy (==':') texinputs) f
979readFileFromDirs :: PandocMonad m => [FilePath] -> FilePath -> m String
979readFileFromDirs :: PandocMonad m => [FilePath] -> FilePath -> m String
980−readFileFromDirs ds f =
980+readFileFromDirs [] f = do
981− mconcat <$> mapM (\d -> readFileLazy' (d </> f)) ds
983−readFileLazy' :: PandocMonad m => FilePath -> m String
984−readFileLazy' f = catchError (UTF8.toStringLazy <$> readFileLazy f) $
985− \(e :: PandocError) -> do
986− warning $ "Could not load include file " ++ f ++ ", skipping.\n" ++ show e
981+ warning $ "Could not load include file " ++ f ++ ", skipping."
987 return ""
982 return ""
983+readFileFromDirs (d:ds) f = do
984+ res <- readFileLazy' (d </> f)
987+ Left _ -> readFileFromDirs ds f
989+readFileLazy' :: PandocMonad m => FilePath -> m (Either PandocError String)
990+readFileLazy' f = catchError ((Right . UTF8.toStringLazy) <$> readFileLazy f) $
991+ \(e :: PandocError) -> return (Left e)