LaTeX reader: further fixes to include.
This commit is contained in:
parent
62b30d8418
commit
7a68617556
1 changed files with 11 additions and 7 deletions
|
@ -977,14 +977,18 @@ readTeXFile f = do
|
||||||
readFileFromDirs (splitBy (==':') texinputs) f
|
readFileFromDirs (splitBy (==':') texinputs) f
|
||||||
|
|
||||||
readFileFromDirs :: PandocMonad m => [FilePath] -> FilePath -> m String
|
readFileFromDirs :: PandocMonad m => [FilePath] -> FilePath -> m String
|
||||||
readFileFromDirs ds f =
|
readFileFromDirs [] f = do
|
||||||
mconcat <$> mapM (\d -> readFileLazy' (d </> f)) ds
|
warning $ "Could not load include file " ++ f ++ ", skipping."
|
||||||
|
|
||||||
readFileLazy' :: PandocMonad m => FilePath -> m String
|
|
||||||
readFileLazy' f = catchError (UTF8.toStringLazy <$> readFileLazy f) $
|
|
||||||
\(e :: PandocError) -> do
|
|
||||||
warning $ "Could not load include file " ++ f ++ ", skipping.\n" ++ show e
|
|
||||||
return ""
|
return ""
|
||||||
|
readFileFromDirs (d:ds) f = do
|
||||||
|
res <- readFileLazy' (d </> f)
|
||||||
|
case res of
|
||||||
|
Right s -> return s
|
||||||
|
Left _ -> readFileFromDirs ds f
|
||||||
|
|
||||||
|
readFileLazy' :: PandocMonad m => FilePath -> m (Either PandocError String)
|
||||||
|
readFileLazy' f = catchError ((Right . UTF8.toStringLazy) <$> readFileLazy f) $
|
||||||
|
\(e :: PandocError) -> return (Left e)
|
||||||
|
|
||||||
----
|
----
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue