From 1a2f8733b645ce9c91c2eb221e0e2fb37e246c72 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Mon, 19 Oct 2020 10:36:19 -0700 Subject: Normalize rewritten image paths with --extract-media. This change will avoid mixed paths like this one when `--extract-media` is used with a Word file: `![](C:\Git\TIJ4\Markdown/media/image30.wmf)` Instead we'll get `![](C:\Git\TIJ4\Markdown`media`image30.wmf)`. Closes #6761. --- src/Text/Pandoc/Class/IO.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/Text/Pandoc/Class') diff --git a/src/Text/Pandoc/Class/IO.hs b/src/Text/Pandoc/Class/IO.hs index c38a37844..eecda5711 100644 --- a/src/Text/Pandoc/Class/IO.hs +++ b/src/Text/Pandoc/Class/IO.hs @@ -227,5 +227,6 @@ writeMedia dir mediabag subpath = do -- returns the element unchanged otherwise. adjustImagePath :: FilePath -> [FilePath] -> Inline -> Inline adjustImagePath dir paths (Image attr lab (src, tit)) - | unpack src `elem` paths = Image attr lab (pack dir <> "/" <> src, tit) + | unpack src `elem` paths + = Image attr lab (pack (normalise $ dir unpack src), tit) adjustImagePath _ _ x = x -- cgit v1.2.3