diff options
author | John MacFarlane <jgm@berkeley.edu> | 2011-07-16 14:04:19 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2011-07-16 14:19:45 -0700 |
commit | b5da7adfb8ba38ac662695989b81b6e0875ac2fe (patch) | |
tree | bd5b2ff17de707aeab074fba299280aa2cc1d27f /src/Text/Pandoc/Writers/ODT.hs | |
parent | fd46f610e3d127b27701795930b1e7f1a8b896fb (diff) | |
download | pandoc-b5da7adfb8ba38ac662695989b81b6e0875ac2fe.tar.gz |
Un-URI-escape image filenames in LaTeX, ConTeXt, RTF, Texinfo.
Also do this when copying image files into EPUBs and ODTs.
Closes #263.
Diffstat (limited to 'src/Text/Pandoc/Writers/ODT.hs')
-rw-r--r-- | src/Text/Pandoc/Writers/ODT.hs | 6 |
1 files changed, 4 insertions, 2 deletions
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)) |