From e4b6196636682386287ed6ec023e3707aeaabde1 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Tue, 29 Jul 2025 14:25:23 -0700 Subject: LaTeX writer: be more conservative about using `\url`. We only use it when the URL is all ASCII, since the `\url` macro causes problems when used with some non-ASCII characters. Closes #8802. --- src/Text/Pandoc/Writers/LaTeX.hs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Text/Pandoc/Writers/LaTeX.hs b/src/Text/Pandoc/Writers/LaTeX.hs index 84bdbefea..f9261eb87 100644 --- a/src/Text/Pandoc/Writers/LaTeX.hs +++ b/src/Text/Pandoc/Writers/LaTeX.hs @@ -31,7 +31,7 @@ import Control.Monad when, unless ) import Data.Containers.ListUtils (nubOrd) -import Data.Char (isDigit) +import Data.Char (isDigit, isAscii) import Data.List (intersperse, (\\)) import Data.Maybe (catMaybes, fromMaybe, isJust, mapMaybe, isNothing) import Data.Monoid (Any (..)) @@ -1053,7 +1053,9 @@ inlineToLaTeX (Link (id',_,_) txt (src,_)) = then "\\hyperlink" <> braces (literal lab) <> braces contents else "\\hyperref" <> brackets (literal lab) <> braces contents _ -> case txt of - [Str x] | unEscapeString (T.unpack x) == unEscapeString (T.unpack src) -> -- autolink + [Str x] | T.all isAscii x -- see #8802 + , unEscapeString (T.unpack x) == + unEscapeString (T.unpack src) -> -- autolink do modify $ \s -> s{ stUrl = True } src' <- stringToLaTeX URLString (escapeURI src) return $ literal $ "\\url{" <> src' <> "}" -- cgit v1.2.3