aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pandoc.cabal6
-rw-r--r--src/Text/Pandoc/Shared.hs2
-rw-r--r--src/Text/Pandoc/Writers/EPUB.hs2
-rw-r--r--src/Text/Pandoc/Writers/HTML.hs4
-rw-r--r--src/Text/Pandoc/Writers/LaTeX.hs11
-rw-r--r--tests/writer.latex3
6 files changed, 16 insertions, 12 deletions
diff --git a/pandoc.cabal b/pandoc.cabal
index 7b9c8b2ea..d9132c568 100644
--- a/pandoc.cabal
+++ b/pandoc.cabal
@@ -250,7 +250,7 @@ Library
tagsoup >= 0.13.1 && < 0.14,
base64-bytestring >= 0.1 && < 1.1,
zlib >= 0.5 && < 0.6,
- highlighting-kate >= 0.5.8.3 && < 0.6,
+ highlighting-kate >= 0.5.8.4 && < 0.6,
data-default >= 0.4 && < 0.6,
temporary >= 1.1 && < 1.3,
blaze-html >= 0.5 && < 0.8,
@@ -358,7 +358,7 @@ Executable pandoc
text >= 0.11 && < 1.2,
bytestring >= 0.9 && < 0.11,
extensible-exceptions >= 0.1 && < 0.2,
- highlighting-kate >= 0.5.8.3 && < 0.6,
+ highlighting-kate >= 0.5.8.4 && < 0.6,
aeson >= 0.7.0.5 && < 0.8,
yaml >= 0.8.8.2 && < 0.9,
containers >= 0.1 && < 0.6,
@@ -401,7 +401,7 @@ Test-Suite test-pandoc
directory >= 1 && < 1.3,
filepath >= 1.1 && < 1.4,
process >= 1 && < 1.3,
- highlighting-kate >= 0.5.8.3 && < 0.6,
+ highlighting-kate >= 0.5.8.4 && < 0.6,
Diff >= 0.2 && < 0.4,
test-framework >= 0.3 && < 0.9,
test-framework-hunit >= 0.2 && < 0.4,
diff --git a/src/Text/Pandoc/Shared.hs b/src/Text/Pandoc/Shared.hs
index 1fd801cd8..bb13836f2 100644
--- a/src/Text/Pandoc/Shared.hs
+++ b/src/Text/Pandoc/Shared.hs
@@ -772,7 +772,7 @@ fetchItem sourceURL s
let mime = case takeExtension s of
".gz" -> getMimeType $ dropExtension s
x -> getMimeType x
- cont <- BS.readFile s
+ cont <- BS.readFile $ unEscapeString s
return (cont, mime)
-- | Read from a URL and return raw data and maybe mime type.
diff --git a/src/Text/Pandoc/Writers/EPUB.hs b/src/Text/Pandoc/Writers/EPUB.hs
index 1bdb01d1d..cc6883a92 100644
--- a/src/Text/Pandoc/Writers/EPUB.hs
+++ b/src/Text/Pandoc/Writers/EPUB.hs
@@ -333,7 +333,7 @@ writeEPUB opts doc@(Pandoc meta _) = do
if epub3
then MathML Nothing
else writerHTMLMathMethod opts
- , writerWrapText = False }
+ , writerWrapText = True }
metadata <- getEPUBMetadata opts' meta
-- cover page
diff --git a/src/Text/Pandoc/Writers/HTML.hs b/src/Text/Pandoc/Writers/HTML.hs
index 744e88c16..3f4c19b67 100644
--- a/src/Text/Pandoc/Writers/HTML.hs
+++ b/src/Text/Pandoc/Writers/HTML.hs
@@ -725,10 +725,6 @@ inlineToHtml opts inline =
_ -> return mempty
| f == Format "html" -> return $ preEscapedString str
| otherwise -> return mempty
- (Link [Str str] (s,_)) | "mailto:" `isPrefixOf` s &&
- s == escapeURI ("mailto" ++ str) ->
- -- autolink
- return $ obfuscateLink opts str s
(Link txt (s,_)) | "mailto:" `isPrefixOf` s -> do
linkText <- inlineListToHtml opts txt
return $ obfuscateLink opts (renderHtml linkText) s
diff --git a/src/Text/Pandoc/Writers/LaTeX.hs b/src/Text/Pandoc/Writers/LaTeX.hs
index 5bbe30fc8..0197d5db6 100644
--- a/src/Text/Pandoc/Writers/LaTeX.hs
+++ b/src/Text/Pandoc/Writers/LaTeX.hs
@@ -757,10 +757,17 @@ inlineToLaTeX (Link txt ('#':ident, _)) = do
return $ text "\\hyperref" <> brackets (text lab) <> braces contents
inlineToLaTeX (Link txt (src, _)) =
case txt of
- [Str x] | x == src -> -- autolink
+ [Str x] | escapeURI x == src -> -- autolink
do modify $ \s -> s{ stUrl = True }
- src' <- stringToLaTeX URLString x
+ src' <- stringToLaTeX URLString src
return $ text $ "\\url{" ++ src' ++ "}"
+ [Str x] | "mailto:" `isPrefixOf` src &&
+ escapeURI x == drop 7 src -> -- email autolink
+ do modify $ \s -> s{ stUrl = True }
+ src' <- stringToLaTeX URLString src
+ contents <- inlineListToLaTeX txt
+ return $ "\\href" <> braces (text src') <>
+ braces ("\\nolinkurl" <> braces contents)
_ -> do contents <- inlineListToLaTeX txt
src' <- stringToLaTeX URLString src
return $ text ("\\href{" ++ src' ++ "}{") <>
diff --git a/tests/writer.latex b/tests/writer.latex
index 1ac79feca..bf08c7111 100644
--- a/tests/writer.latex
+++ b/tests/writer.latex
@@ -888,7 +888,8 @@ With an ampersand: \url{http://example.com/?foo=1\&bar=2}
It should.
\end{itemize}
-An e-mail address: \href{mailto:nobody@nowhere.net}{nobody@nowhere.net}
+An e-mail address:
+\href{mailto:nobody@nowhere.net}{\nolinkurl{nobody@nowhere.net}}
\begin{quote}
Blockquoted: \url{http://example.com/}