aboutsummaryrefslogtreecommitdiff
path: root/src/Text
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2016-07-01 15:47:06 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2016-07-01 15:47:42 -0700
commite0cc9e446351c7a9bbb800932f70d5692f5d31da (patch)
treee0033a0848978d6b21e2f864d5e1a1fce33c64d8 /src/Text
parent7e712abfa6d5deea5a17e05183be513e5a250eb2 (diff)
downloadpandoc-e0cc9e446351c7a9bbb800932f70d5692f5d31da.tar.gz
LaTeX reader: strip off double quotes around image source if present.
Avoids interpreting these as part of the literal filename. See #2825.
Diffstat (limited to 'src/Text')
-rw-r--r--src/Text/Pandoc/Readers/LaTeX.hs9
1 files changed, 8 insertions, 1 deletions
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