diff options
| author | John MacFarlane <[email protected]> | 2022-10-26 18:51:50 -0700 |
|---|---|---|
| committer | John MacFarlane <[email protected]> | 2022-10-26 18:51:50 -0700 |
| commit | 246e14e75a342ce8e1db8f4085cbb49b9fd2a990 (patch) | |
| tree | dd9c67e184b6574fb4875db48280ac222ec7ba1d | |
| parent | b8047e350ce6917435db49bfa107994236373b51 (diff) | |
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.
| -rw-r--r-- | src/Text/Pandoc/Readers/LaTeX.hs | 7 | ||||
| -rw-r--r-- | 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. |
