From 5b1fdeaf41d6ee4b6b82cbeb4e7f7508182b3566 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Thu, 20 Sep 2018 09:35:43 -0700 Subject: ConTeXt writer: change `\` to `/` in Windows image paths. We do this in the LaTeX writer, and it avoids problems. Note that `/` works as a LaTeX path separator on Windows. Closes #4918. --- src/Text/Pandoc/Writers/ConTeXt.hs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/Text/Pandoc/Writers/ConTeXt.hs b/src/Text/Pandoc/Writers/ConTeXt.hs index 763f1a370..4947d7f79 100644 --- a/src/Text/Pandoc/Writers/ConTeXt.hs +++ b/src/Text/Pandoc/Writers/ConTeXt.hs @@ -453,7 +453,12 @@ inlineToConTeXt (Image attr@(_,cls,_) _ (src, _)) = do clas = if null cls then empty else brackets $ text $ toLabel $ head cls - src' = if isURI src + -- Use / for path separators on Windows; see #4918 + fixPathSeparators = map $ \c -> case c of + '\\' -> '/' + c -> c + src' = fixPathSeparators $ + if isURI src then src else unEscapeString src return $ braces $ "\\externalfigure" <> brackets (text src') <> dims <> clas -- cgit v1.2.3