From 246e14e75a342ce8e1db8f4085cbb49b9fd2a990 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Wed, 26 Oct 2022 18:51:50 -0700 Subject: LaTeX reader: fix TEXINPUTS handling. If TEXINPUTS ends with `:`, then the system default TEXINPUTS is added. We handle this by just adding the working directory in this case. Closes #8392. --- src/Text/Pandoc/Readers/LaTeX.hs | 7 +++++-- src/Text/Pandoc/XML.hs | 3 ++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Text/Pandoc/Readers/LaTeX.hs b/src/Text/Pandoc/Readers/LaTeX.hs index a84186aa9..cfe6d1299 100644 --- a/src/Text/Pandoc/Readers/LaTeX.hs +++ b/src/Text/Pandoc/Readers/LaTeX.hs @@ -756,8 +756,11 @@ readFileFromTexinputs fp = do case M.lookup (T.pack fp) fileContentsMap of Just t -> return (Just t) Nothing -> do - dirs <- map T.unpack . splitTextBy (==':') . fromMaybe "." - <$> lookupEnv "TEXINPUTS" + dirs <- map (\t -> if T.null t + then "." + else T.unpack t) + . T.split (==':') . fromMaybe "" + <$> lookupEnv "TEXINPUTS" readFileFromDirs dirs fp ensureExtension :: (FilePath -> Bool) -> FilePath -> FilePath -> FilePath diff --git a/src/Text/Pandoc/XML.hs b/src/Text/Pandoc/XML.hs index 30ecac890..b811336d5 100644 --- a/src/Text/Pandoc/XML.hs +++ b/src/Text/Pandoc/XML.hs @@ -30,9 +30,10 @@ import Data.Text (Text) import qualified Data.Text as T import Text.HTML.TagSoup.Entity (lookupEntity, htmlEntities) import Text.DocLayout + ( ($$), char, hcat, nest, text, Doc, HasChars ) import Text.Printf (printf) import qualified Data.Map as M -import Data.String +import Data.String ( IsString ) import qualified Data.Set as Set -- | Escape one character as needed for XML. -- cgit v1.2.3