diff options
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r-- | src/Text/Pandoc/Readers/LaTeX.hs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Readers/LaTeX.hs b/src/Text/Pandoc/Readers/LaTeX.hs index 6f3090e10..942b9f3b3 100644 --- a/src/Text/Pandoc/Readers/LaTeX.hs +++ b/src/Text/Pandoc/Readers/LaTeX.hs @@ -898,6 +898,12 @@ backslash' = string "\\" braced' :: IncludeParser braced' = try $ char '{' *> manyTill (satisfy (/='}')) (char '}') +maybeAddExtension :: String -> FilePath -> FilePath +maybeAddExtension ext fp = + if null (takeExtension fp) + then addExtension fp ext + else fp + include' :: IncludeParser include' = do fs' <- try $ do @@ -909,8 +915,8 @@ include' = do skipMany $ try $ char '[' *> (manyTill anyChar (char ']')) fs <- (map trim . splitBy (==',')) <$> braced' return $ if name == "usepackage" - then map (flip replaceExtension ".sty") fs - else map (flip replaceExtension ".tex") fs + then map (maybeAddExtension ".sty") fs + else map (maybeAddExtension ".tex") fs pos <- getPosition containers <- getState let fn = case containers of |