aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Writers
diff options
context:
space:
mode:
authorJohn MacFarlane <fiddlosopher@gmail.com>2013-07-25 20:29:42 -0700
committerJohn MacFarlane <fiddlosopher@gmail.com>2013-07-25 20:29:42 -0700
commitd5fad2306a27b3fcf2c85782dd13bc8e516a5df9 (patch)
treefa645cbbafd6c8b7dab4fd4124de6bf1198be593 /src/Text/Pandoc/Writers
parentfb9f2e4bd5f71c7b515566921c5c5a7bff73c52c (diff)
downloadpandoc-d5fad2306a27b3fcf2c85782dd13bc8e516a5df9.tar.gz
LaTeX writer: Change `\` to `/` in paths.
`/` works even on Windows in LaTeX. `\` will cause major problems if unescaped.
Diffstat (limited to 'src/Text/Pandoc/Writers')
-rw-r--r--src/Text/Pandoc/Writers/LaTeX.hs6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Writers/LaTeX.hs b/src/Text/Pandoc/Writers/LaTeX.hs
index 2b4a608a7..06a04ade2 100644
--- a/src/Text/Pandoc/Writers/LaTeX.hs
+++ b/src/Text/Pandoc/Writers/LaTeX.hs
@@ -202,7 +202,8 @@ stringToLaTeX ctx (x:xs) = do
_ -> '-' : rest
'~' | not isUrl -> "\\textasciitilde{}" ++ rest
'^' -> "\\^{}" ++ rest
- '\\' -> "\\textbackslash{}" ++ rest
+ '\\'| isUrl -> '/' : rest -- NB. / works as path sep even on Windows
+ | otherwise -> "\\textbackslash{}" ++ rest
'|' -> "\\textbar{}" ++ rest
'<' -> "\\textless{}" ++ rest
'>' -> "\\textgreater{}" ++ rest
@@ -648,7 +649,8 @@ inlineToLaTeX (Image _ (source, _)) = do
let source' = if isAbsoluteURI source
then source
else unEscapeString source
- return $ "\\includegraphics" <> braces (text source')
+ source'' <- stringToLaTeX URLString source'
+ return $ "\\includegraphics" <> braces (text source'')
inlineToLaTeX (Note contents) = do
modify (\s -> s{stInNote = True})
contents' <- blockListToLaTeX contents