aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <[email protected]>2025-07-29 14:25:23 -0700
committerJohn MacFarlane <[email protected]>2025-07-29 14:25:23 -0700
commite4b6196636682386287ed6ec023e3707aeaabde1 (patch)
treea98eff916c11ebbf14d05373ae3c33a047092e62
parentce6ef5cad0e9d05986aff4fe6ee00fa99b69ea9d (diff)
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.
-rw-r--r--src/Text/Pandoc/Writers/LaTeX.hs6
1 files 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' <> "}"