diff options
author | John MacFarlane <jgm@berkeley.edu> | 2019-01-20 18:22:19 -0800 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2019-01-20 18:22:19 -0800 |
commit | 11810edb2f51fa54af4d5a9a4b3e57a189077919 (patch) | |
tree | aeae47a4c3d77d788fa0707cf7ba5df2809888f9 /src | |
parent | 26dfab2e61b45722967e2a2f9330bf5e101b9f31 (diff) | |
download | pandoc-11810edb2f51fa54af4d5a9a4b3e57a189077919.tar.gz |
LaTeX reader: allow includes with dots like cc_by_4.0.
Previously the `.0` was interpreted as a file extension,
leading pandoc not to add `.tex` (and thus not to find the
file).
The new behavior matches tex more closely.
Diffstat (limited to 'src')
-rw-r--r-- | src/Text/Pandoc/Readers/LaTeX.hs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/Text/Pandoc/Readers/LaTeX.hs b/src/Text/Pandoc/Readers/LaTeX.hs index 3120afaec..f5d8527dd 100644 --- a/src/Text/Pandoc/Readers/LaTeX.hs +++ b/src/Text/Pandoc/Readers/LaTeX.hs @@ -1449,9 +1449,11 @@ include name = do fs <- (map (T.unpack . removeDoubleQuotes . T.strip) . T.splitOn "," . untokenize) <$> braced let addExt f = case takeExtension f of - "" | name == "usepackage" -> addExtension f ".sty" - | otherwise -> addExtension f ".tex" - _ -> f + ".tex" -> f + ".sty" -> f + -- note, we can have cc_by_4.0 for example... + _ | name == "usepackage" -> addExtension f ".sty" + | otherwise -> addExtension f ".tex" dirs <- (splitBy (==':') . fromMaybe ".") <$> lookupEnv "TEXINPUTS" mapM_ (insertIncluded dirs) (map addExt fs) return mempty |