git.iko.soy/typeable/pandoc
on master help sign in
LaTeX writer: Properly escape strings inside \url{}.

Closes #576.

commit1e2b20f8bc97965bbe98b318185b2b58a1d46845 authorJohn MacFarlane <fiddlosopher@gmail.com> dateSun 16 Sep 2012, 11:20 (14 years ago) parent23e1a25
2 files changed+3−2
src/Text/Pandoc/Writers/LaTeX.hs+2−1 tests/writer.latex+1−1
src/Text/Pandoc/Writers/LaTeX.hs+2−1
@@ -577,7 +577,8 @@ inlineToLaTeX (Link txt (src, _)) =
577577 case txt of
578578 [Code _ x] | x == src -> -- autolink
579579 do modify $ \s -> s{ stUrl = True }
580− return $ text $ "\\url{" ++ x ++ "}"
580+ src' <- stringToLaTeX True x
581+ return $ text $ "\\url{" ++ src' ++ "}"
581582 _ -> do contents <- inlineListToLaTeX txt
582583 src' <- stringToLaTeX True src
583584 return $ text ("\\href{" ++ src' ++ "}{") <>
tests/writer.latex+1−1
@@ -834,7 +834,7 @@ Here's an \href{/script?foo=1\&bar=2}{inline link in pointy braces}.
834834
835835\subsection{Autolinks}
836836
837−With an ampersand: \url{http://example.com/?foo=1&bar=2}
837+With an ampersand: \url{http://example.com/?foo=1\&bar=2}
838838
839839\begin{itemize}
840840\item