git.iko.soy/typeable/pandoc
on master help sign in
Normalize rewritten image paths with --extract-media.
1a2f873John MacFarlane
src/Text/Pandoc/Class/IO.hs+2−1
@@ -227,5 +227,6 @@ writeMedia dir mediabag subpath = do
227-- returns the element unchanged otherwise.
227-- returns the element unchanged otherwise.
228adjustImagePath :: FilePath -> [FilePath] -> Inline -> Inline
228adjustImagePath :: FilePath -> [FilePath] -> Inline -> Inline
229adjustImagePath dir paths (Image attr lab (src, tit))
229adjustImagePath dir paths (Image attr lab (src, tit))
230+ | unpack src `elem` paths
230− | unpack src `elem` paths = Image attr lab (pack dir <> "/" <> src, tit)
231+ = Image attr lab (pack (normalise $ dir </> unpack src), tit)
231adjustImagePath _ _ x = x
232adjustImagePath _ _ x = x