From 11810edb2f51fa54af4d5a9a4b3e57a189077919 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Sun, 20 Jan 2019 18:22:19 -0800 Subject: 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. --- src/Text/Pandoc/Readers/LaTeX.hs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src') 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 -- cgit v1.2.3