diff options
-rw-r--r-- | src/Text/Pandoc/Writers/LaTeX.hs | 7 | ||||
-rw-r--r-- | tests/writer.latex | 6 |
2 files changed, 8 insertions, 5 deletions
diff --git a/src/Text/Pandoc/Writers/LaTeX.hs b/src/Text/Pandoc/Writers/LaTeX.hs index 19365a0f5..d907e8b88 100644 --- a/src/Text/Pandoc/Writers/LaTeX.hs +++ b/src/Text/Pandoc/Writers/LaTeX.hs @@ -250,9 +250,12 @@ inlineToLaTeX (HtmlInline str) = return "" inlineToLaTeX (LineBreak) = return "\\\\\n" inlineToLaTeX Space = return " " inlineToLaTeX (Link text (src, tit)) = do - contents <- inlineListToLaTeX $ deVerb text addToHeader "\\usepackage[breaklinks=true]{hyperref}" - return $ "\\href{" ++ src ++ "}{" ++ contents ++ "}" + case text of + [Code x] | x == src -> -- autolink + return $ "\\url{" ++ x ++ "}" + _ -> do contents <- inlineListToLaTeX $ deVerb text + return $ "\\href{" ++ src ++ "}{" ++ contents ++ "}" inlineToLaTeX (Image alternate (source, tit)) = do addToHeader "\\usepackage{graphicx}" return $ "\\includegraphics{" ++ source ++ "}" diff --git a/tests/writer.latex b/tests/writer.latex index 215630fa1..15c4e558a 100644 --- a/tests/writer.latex +++ b/tests/writer.latex @@ -590,17 +590,17 @@ Here's an \href{/script?foo=1&bar=2}{inline link in pointy braces}. \subsection{Autolinks} -With an ampersand: \href{http://example.com/?foo=1&bar=2}{\texttt{http://example.com/?foo=1\&bar=2}} +With an ampersand: \url{http://example.com/?foo=1&bar=2} \begin{itemize} \item In a list? -\item \href{http://example.com/}{\texttt{http://example.com/}} +\item \url{http://example.com/} \item It should. \end{itemize} An e-mail address: \href{mailto:nobody@nowhere.net}{\texttt{nobody@nowhere.net}} \begin{quote} -Blockquoted: \href{http://example.com/}{\texttt{http://example.com/}} +Blockquoted: \url{http://example.com/} \end{quote} Auto-links should not occur here: \verb!<http://example.com/>! |