git.iko.soy/typeable/pandoc
on master help sign in
LaTeX reader: strip off double quotes around image source if present.

Avoids interpreting these as part of the literal filename. See #2825.

commite0cc9e446351c7a9bbb800932f70d5692f5d31da authorJohn MacFarlane <jgm@berkeley.edu> dateFri 1 Jul 2016, 15:47 (10 years ago) parent7e712ab
1 file changed+8−1
src/Text/Pandoc/Readers/LaTeX.hs+8−1
src/Text/Pandoc/Readers/LaTeX.hs+8−1
@@ -556,7 +556,7 @@ inlineCommands = M.fromList $
556556 tok >>= \lab ->
557557 pure (link url "" lab))
558558 , ("includegraphics", do options <- option [] keyvals
559− src <- unescapeURL <$> braced
559+ src <- unescapeURL . removeDoubleQuotes <$> braced
560560 mkImage options src)
561561 , ("enquote", enquote)
562562 , ("cite", citation "cite" NormalCitation False)
@@ -1396,3 +1396,10 @@ endInclude = do
13961396 co <- braced
13971397 setPosition $ newPos fn (fromMaybe 1 $ safeRead ln) (fromMaybe 1 $ safeRead co)
13981398 return mempty
1399+
1400+removeDoubleQuotes :: String -> String
1401+removeDoubleQuotes ('"':xs) =
1402+ case reverse xs of
1403+ '"':ys -> reverse ys
1404+ _ -> '"':xs
1405+removeDoubleQuotes xs = xs