git.iko.soy/typeable/pandoc
on master help sign in
LaTeX writer: Change `\` to `/` in paths.

`/` works even on Windows in LaTeX. `\` will cause major problems if unescaped.

commitd5fad2306a27b3fcf2c85782dd13bc8e516a5df9 authorJohn MacFarlane <fiddlosopher@gmail.com> dateThu 25 Jul 2013, 20:29 (13 years ago) parentfb9f2e4
1 file changed+4−2
src/Text/Pandoc/Writers/LaTeX.hs+4−2
src/Text/Pandoc/Writers/LaTeX.hs+4−2
@@ -202,7 +202,8 @@ stringToLaTeX ctx (x:xs) = do
202202 _ -> '-' : rest
203203 '~' | not isUrl -> "\\textasciitilde{}" ++ rest
204204 '^' -> "\\^{}" ++ rest
205− '\\' -> "\\textbackslash{}" ++ rest
205+ '\\'| isUrl -> '/' : rest -- NB. / works as path sep even on Windows
206+ | otherwise -> "\\textbackslash{}" ++ rest
206207 '|' -> "\\textbar{}" ++ rest
207208 '<' -> "\\textless{}" ++ rest
208209 '>' -> "\\textgreater{}" ++ rest
@@ -648,7 +649,8 @@ inlineToLaTeX (Image _ (source, _)) = do
648649 let source' = if isAbsoluteURI source
649650 then source
650651 else unEscapeString source
651− return $ "\\includegraphics" <> braces (text source')
652+ source'' <- stringToLaTeX URLString source'
653+ return $ "\\includegraphics" <> braces (text source'')
652654inlineToLaTeX (Note contents) = do
653655 modify (\s -> s{stInNote = True})
654656 contents' <- blockListToLaTeX contents