git.iko.soy/typeable/pandoc
on master help sign in
Use \url{} for autolinks in LaTeX writer.

git-svn-id: https://pandoc.googlecode.com/svn/trunk@832 788f1e2b-df1e-0410-8736-df70ead52e1b

commit271c3f987e468b77ac9209e9efe3bbaa51717039 authorfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> dateFri 3 Aug 2007, 22:14 (19 years ago) parentee46ee5
2 files changed+8−5
src/Text/Pandoc/Writers/LaTeX.hs+5−2 tests/writer.latex+3−3
src/Text/Pandoc/Writers/LaTeX.hs+5−2
@@ -250,9 +250,12 @@ inlineToLaTeX (HtmlInline str) = return ""
250250inlineToLaTeX (LineBreak) = return "\\\\\n"
251251inlineToLaTeX Space = return " "
252252inlineToLaTeX (Link text (src, tit)) = do
253− contents <- inlineListToLaTeX $ deVerb text
254253 addToHeader "\\usepackage[breaklinks=true]{hyperref}"
255− return $ "\\href{" ++ src ++ "}{" ++ contents ++ "}"
254+ case text of
255+ [Code x] | x == src -> -- autolink
256+ return $ "\\url{" ++ x ++ "}"
257+ _ -> do contents <- inlineListToLaTeX $ deVerb text
258+ return $ "\\href{" ++ src ++ "}{" ++ contents ++ "}"
256259inlineToLaTeX (Image alternate (source, tit)) = do
257260 addToHeader "\\usepackage{graphicx}"
258261 return $ "\\includegraphics{" ++ source ++ "}"
tests/writer.latex+3−3
@@ -590,17 +590,17 @@ Here's an \href{/script?foo=1&bar=2}{inline link in pointy braces}.
590590
591591\subsection{Autolinks}
592592
593−With an ampersand: \href{http://example.com/?foo=1&bar=2}{\texttt{http://example.com/?foo=1\&bar=2}}
593+With an ampersand: \url{http://example.com/?foo=1&bar=2}
594594
595595\begin{itemize}
596596\item In a list?
597−\item \href{http://example.com/}{\texttt{http://example.com/}}
597+\item \url{http://example.com/}
598598\item It should.
599599\end{itemize}
600600An e-mail address: \href{mailto:nobody@nowhere.net}{\texttt{nobody@nowhere.net}}
601601
602602\begin{quote}
603−Blockquoted: \href{http://example.com/}{\texttt{http://example.com/}}
603+Blockquoted: \url{http://example.com/}
604604
605605\end{quote}
606606Auto-links should not occur here: \verb!<http://example.com/>!