diff options
author | John MacFarlane <jgm@berkeley.edu> | 2018-09-20 09:35:43 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2018-09-20 09:36:44 -0700 |
commit | 5b1fdeaf41d6ee4b6b82cbeb4e7f7508182b3566 (patch) | |
tree | 841b326d2cc9969e2cb772e33a3ae32443714196 /src/Text/Pandoc/Writers | |
parent | 136bf901aa088eaf4e5c996c71e0a36c171f1587 (diff) | |
download | pandoc-5b1fdeaf41d6ee4b6b82cbeb4e7f7508182b3566.tar.gz |
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.
Diffstat (limited to 'src/Text/Pandoc/Writers')
-rw-r--r-- | src/Text/Pandoc/Writers/ConTeXt.hs | 7 |
1 files changed, 6 insertions, 1 deletions
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 |