git.iko.soy/typeable/pandoc
on master help sign in
Revert "LaTeX reader: Use kpsewhich to find paths for handleIncludes."
3f87c43John MacFarlane
src/Text/Pandoc/Readers/LaTeX.hs+1−11
@@ -44,8 +44,6 @@ import Data.Char (isLetter)
44import Control.Applicative
44import Control.Applicative
45import Data.Monoid
45import Data.Monoid
46import System.FilePath (replaceExtension)
46import System.FilePath (replaceExtension)
47−import System.Exit (ExitCode(..))
48−import System.Process (readProcessWithExitCode)
49import qualified Data.Map as M
47import qualified Data.Map as M
50
48
51-- | Parse LaTeX from string and return 'Pandoc' document.
49-- | Parse LaTeX from string and return 'Pandoc' document.
@@ -538,7 +536,7 @@ handleIncludes :: String -> IO String
538handleIncludes [] = return []
536handleIncludes [] = return []
539handleIncludes ('\\':xs) =
537handleIncludes ('\\':xs) =
540 case runParser include defaultParserState "input" ('\\':xs) of
538 case runParser include defaultParserState "input" ('\\':xs) of
541− Right (f, rest) -> do ys <- catch (kpsewhich f >>= readFile)
539+ Right (f, rest) -> do ys <- catch (readFile f)
542 (\e -> warn
540 (\e -> warn
543 ("could not open included file `" ++
541 ("could not open included file `" ++
544 f ++ "': " ++ show e) >> return "")
542 f ++ "': " ++ show e) >> return "")
@@ -570,14 +568,6 @@ verbatimEnv = do
570 rest <- getInput
568 rest <- getInput
571 return (r,rest)
569 return (r,rest)
572
570
573−kpsewhich :: FilePath -> IO FilePath
574−kpsewhich f = do
575− (ec, ou, _) <- catch (readProcessWithExitCode "kpsewhich" [f] "")
576− (\_ -> return (ExitFailure 1, f, ""))
577− if ec == ExitSuccess
578− then return $ trim ou
579− else return f
580−
581-- | Parse any LaTeX environment and return a string containing
571-- | Parse any LaTeX environment and return a string containing
582-- the whole literal environment as raw TeX.
572-- the whole literal environment as raw TeX.
583rawLaTeXBlock :: GenParser Char ParserState String
573rawLaTeXBlock :: GenParser Char ParserState String