git.iko.soy/typeable/pandoc
on master help sign in
Improved fix to #5340 and added test.
commit6be8f4e953b6ba9a7af1b707ef3902f8a5b7b8e2 authorJohn MacFarlane <jgm@berkeley.edu> dateMon 18 Mar 2019, 16:53 (8 years ago) parentc576499
2 files changed+16−2
src/Text/Pandoc/Writers/LaTeX.hs+2−2 test/command/5340.md+14
src/Text/Pandoc/Writers/LaTeX.hs+2−2
@@ -1219,12 +1219,12 @@ inlineToLaTeX (Link _ txt ('#':ident, _)) = do
12191219 return $ text "\\protect\\hyperlink" <> braces (text lab) <> braces contents
12201220inlineToLaTeX (Link _ txt (src, _)) =
12211221 case txt of
1222− [Str x] | x == unEscapeString src -> -- autolink
1222+ [Str x] | unEscapeString x == unEscapeString src -> -- autolink
12231223 do modify $ \s -> s{ stUrl = True }
12241224 src' <- stringToLaTeX URLString (escapeURI src)
12251225 return $ text $ "\\url{" ++ src' ++ "}"
12261226 [Str x] | Just rest <- stripPrefix "mailto:" src,
1227− x == unEscapeString rest -> -- email autolink
1227+ unEscapeString x == unEscapeString rest -> -- email autolink
12281228 do modify $ \s -> s{ stUrl = True }
12291229 src' <- stringToLaTeX URLString (escapeURI src)
12301230 contents <- inlineListToLaTeX txt
test/command/5340.mdnew file+14
@@ -0,0 +1,14 @@
1+```
2+% pandoc -f html -t latex --wrap=preserve
3+<a href="https://example.com/foo-bar">https://example.com/foo-bar</a>
4+<a href="https://example.com/foo--bar">https://example.com/foo--bar</a>
5+<a href="https://example.com/foo%2Dbar">https://example.com/foo-bar</a>
6+<a href="https://example.com/foo%2D%2Dbar">https://example.com/foo--bar</a>
7+<a href="https://example.com/foo%2D%2Dbar">https://example.com/foo%2D%2Dbar</a>
8+^D
9+\url{https://example.com/foo-bar}
10+\url{https://example.com/foo--bar}
11+\url{https://example.com/foo\%2Dbar}
12+\url{https://example.com/foo\%2D\%2Dbar}
13+\url{https://example.com/foo\%2D\%2Dbar}
14+```