git.iko.soy/typeable/pandoc
on master help sign in
LaTeX reader: further fixes to include.
7a68617John MacFarlane
src/Text/Pandoc/Readers/LaTeX.hs+11−7
@@ -977,14 +977,18 @@ readTeXFile f = do
977 readFileFromDirs (splitBy (==':') texinputs) f
977 readFileFromDirs (splitBy (==':') texinputs) f
978
978
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
982−
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)
985+ case res of
986+ Right s -> return s
987+ Left _ -> readFileFromDirs ds f
988+
989+readFileLazy' :: PandocMonad m => FilePath -> m (Either PandocError String)
990+readFileLazy' f = catchError ((Right . UTF8.toStringLazy) <$> readFileLazy f) $
991+ \(e :: PandocError) -> return (Left e)
988
992
989----
993----
990
994