diff options
| author | John MacFarlane <[email protected]> | 2023-08-23 12:37:49 -0700 |
|---|---|---|
| committer | John MacFarlane <[email protected]> | 2023-08-23 12:37:49 -0700 |
| commit | d21a9cd7f80cedb18d97cb92163ae7ec0f3a6237 (patch) | |
| tree | faf70256a8b71bcba012353a6f6e52cfd4b4c281 /src | |
| parent | 7c4354646b57aa0d505dc955f856b8c3443c8db4 (diff) | |
Also escape % in URLs.
This improves the fix to #9017 in commit
7c4354646b57aa0d505dc955f856b8c3443c8db4
An alternative would be to avoid backslash escaping `#` and `%`
in URLs, and instead always add `fragile` to the slide environment.
Diffstat (limited to 'src')
| -rw-r--r-- | src/Text/Pandoc/Writers/LaTeX/Util.hs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Writers/LaTeX/Util.hs b/src/Text/Pandoc/Writers/LaTeX/Util.hs index f19f5ddd5..79937e1fa 100644 --- a/src/Text/Pandoc/Writers/LaTeX/Util.hs +++ b/src/Text/Pandoc/Writers/LaTeX/Util.hs @@ -94,9 +94,12 @@ stringToLaTeX context zs = do in case x of '\\'| isUrl -> emitc '/' -- NB. / works as path sep even on Windows '#' | isUrl -> emits "\\#" -- see #9014 + '%' | isUrl -> emits "\\%" -- see #9014 c | isUrl -> if c `elem` ['{', '}', '|', '^', '~', '[', ']', '`'] - then emits (escapeURIString (const False) [c]) + then do + emitc '\\' -- escape the % see #9014 + emits (escapeURIString (const False) [c]) else emitc c '{' -> emits "\\{" '}' -> emits "\\}" |
