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/LaTeX.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/LaTeX.hs')
-rw-r--r-- | src/Text/Pandoc/Writers/LaTeX.hs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Writers/LaTeX.hs b/src/Text/Pandoc/Writers/LaTeX.hs index cf008bf6a..f3d7af7e5 100644 --- a/src/Text/Pandoc/Writers/LaTeX.hs +++ b/src/Text/Pandoc/Writers/LaTeX.hs @@ -34,6 +34,7 @@ import Text.Pandoc.Generic import Text.Pandoc.Shared import Text.Pandoc.Templates import Text.Printf ( printf ) +import Network.URI ( isAbsoluteURI, unEscapeString ) import Data.List ( (\\), isSuffixOf, isPrefixOf, intercalate, intersperse ) import Data.Char ( toLower, isPunctuation ) import Control.Monad.State @@ -425,7 +426,10 @@ inlineToLaTeX (Link txt (src, _)) = contents <> char '}' inlineToLaTeX (Image _ (source, _)) = do modify $ \s -> s{ stGraphics = True } - return $ "\\includegraphics" <> braces (text source) + let source' = if isAbsoluteURI source + then source + else unEscapeString source + return $ "\\includegraphics" <> braces (text source') inlineToLaTeX (Note contents) = do modify (\s -> s{stInNote = True}) contents' <- blockListToLaTeX contents |