git.iko.soy/typeable/pandoc
on master help sign in
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.

commit1a2f8733b645ce9c91c2eb221e0e2fb37e246c72 authorJohn MacFarlane <jgm@berkeley.edu> dateMon 19 Oct 2020, 10:36 (6 years ago) parent9ecea0b
1 file changed+2−1
src/Text/Pandoc/Class/IO.hs+2−1
src/Text/Pandoc/Class/IO.hs+2−1
@@ -227,5 +227,6 @@ writeMedia dir mediabag subpath = do
227227-- returns the element unchanged otherwise.
228228adjustImagePath :: FilePath -> [FilePath] -> Inline -> Inline
229229adjustImagePath dir paths (Image attr lab (src, tit))
230− | unpack src `elem` paths = Image attr lab (pack dir <> "/" <> src, tit)
230+ | unpack src `elem` paths
231+ = Image attr lab (pack (normalise $ dir </> unpack src), tit)
231232adjustImagePath _ _ x = x