From b5da7adfb8ba38ac662695989b81b6e0875ac2fe Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Sat, 16 Jul 2011 14:04:19 -0700 Subject: Un-URI-escape image filenames in LaTeX, ConTeXt, RTF, Texinfo. Also do this when copying image files into EPUBs and ODTs. Closes #263. --- src/Text/Pandoc/Writers/ODT.hs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/Text/Pandoc/Writers/ODT.hs') diff --git a/src/Text/Pandoc/Writers/ODT.hs b/src/Text/Pandoc/Writers/ODT.hs index cf1be8755..908df1163 100644 --- a/src/Text/Pandoc/Writers/ODT.hs +++ b/src/Text/Pandoc/Writers/ODT.hs @@ -41,6 +41,7 @@ import Text.Pandoc.Generic import Text.Pandoc.Writers.OpenDocument ( writeOpenDocument ) import System.Directory import Control.Monad (liftM) +import Network.URI ( unEscapeString ) -- | Produce an ODT file from a Pandoc document. writeODT :: Maybe FilePath -- ^ Path specified by --reference-odt @@ -74,9 +75,10 @@ writeODT mbRefOdt opts doc = do transformPic :: FilePath -> IORef [Entry] -> Inline -> IO Inline transformPic sourceDir entriesRef (Image lab (src,tit)) = do + let src' = unEscapeString src entries <- readIORef entriesRef - let newsrc = "Pictures/" ++ show (length entries) ++ takeExtension src - catch (readEntry [] (sourceDir src) >>= \entry -> + let newsrc = "Pictures/" ++ show (length entries) ++ takeExtension src' + catch (readEntry [] (sourceDir src') >>= \entry -> modifyIORef entriesRef (entry{ eRelativePath = newsrc } :) >> return (Image lab (newsrc, tit))) (\_ -> return (Emph lab)) -- cgit v1.2.3