From e0cc9e446351c7a9bbb800932f70d5692f5d31da Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Fri, 1 Jul 2016 15:47:06 -0700 Subject: LaTeX reader: strip off double quotes around image source if present. Avoids interpreting these as part of the literal filename. See #2825. --- src/Text/Pandoc/Readers/LaTeX.hs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/Text/Pandoc/Readers/LaTeX.hs') diff --git a/src/Text/Pandoc/Readers/LaTeX.hs b/src/Text/Pandoc/Readers/LaTeX.hs index 258fdfcf4..8100a6823 100644 --- a/src/Text/Pandoc/Readers/LaTeX.hs +++ b/src/Text/Pandoc/Readers/LaTeX.hs @@ -556,7 +556,7 @@ inlineCommands = M.fromList $ tok >>= \lab -> pure (link url "" lab)) , ("includegraphics", do options <- option [] keyvals - src <- unescapeURL <$> braced + src <- unescapeURL . removeDoubleQuotes <$> braced mkImage options src) , ("enquote", enquote) , ("cite", citation "cite" NormalCitation False) @@ -1396,3 +1396,10 @@ endInclude = do co <- braced setPosition $ newPos fn (fromMaybe 1 $ safeRead ln) (fromMaybe 1 $ safeRead co) return mempty + +removeDoubleQuotes :: String -> String +removeDoubleQuotes ('"':xs) = + case reverse xs of + '"':ys -> reverse ys + _ -> '"':xs +removeDoubleQuotes xs = xs -- cgit v1.2.3