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.
This commit is contained in:
John MacFarlane 2019-01-20 18:22:19 -08:00
parent 26dfab2e61
commit 11810edb2f

View file

@ -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