aboutsummaryrefslogtreecommitdiff
path: root/src/Text
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2019-01-20 18:22:19 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2019-01-20 18:22:19 -0800
commit11810edb2f51fa54af4d5a9a4b3e57a189077919 (patch)
treeaeae47a4c3d77d788fa0707cf7ba5df2809888f9 /src/Text
parent26dfab2e61b45722967e2a2f9330bf5e101b9f31 (diff)
downloadpandoc-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/Text')
-rw-r--r--src/Text/Pandoc/Readers/LaTeX.hs8
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