Skip to content

LaTeX writer: URLs are not escaped #2377

Closed
adunning opened this Issue · 6 comments

2 participants

@adunning

Under pandoc 1.15.0.6, some unusual but valid characters in URLs are not escaped by the LaTeX writer. For instance, this produces a broken link:

pandoc -o test.pdf -sS << EOT
> <http://www.digizeitschriften.de/dms/resolveppn/?PID=PPN345858530_0013|log48>
> EOT

It appears in the PDF as http://www.digizeitschriften.de/dms/resolveppn/?PID=PPN345858530_0013\T1\textbar{}log48.

Thread: https://groups.google.com/forum/#!msg/pandoc-discuss/E489etyaKgI/cUFuyicXCAAJ (as far as I can tell, no issue was generated from this).

@adunning

If I'm understanding the code correctly, am I correct in thinking that the fix for this is as simple as adding not isUrl to https://github.com/jgm/pandoc/blob/master/src/Text/Pandoc/Writers/LaTeX.hs#L239?

@jgm
Owner

@adunning I think you are probably right. It would be good, though, to figure out where else this might be needed -- i.e. which characters that are normally escaped should not be escaped in URL contexts.

@adunning

It looks as if it's the list of 'unwise' characters that are not handled within a URL. The question, then, might be whether it would be best to escape these characters in all outputs (which has come up before in #1640).

@adunning

Taking the example from #1640, this also results in an incorrect PDF:

pandoc -F pandoc-citeproc -o test.pdf << EOT
---
references:
- id: test
  DOI: 10.1002/(sici)1097-0185(19990415)257:2<50::aid-ar4>3.3.co;2-n
...

@test

EOT
@jgm jgm added the bug label
@jgm jgm added a commit that referenced this issue
@jgm Percent-encode more special characters in URLs.
HTML, LaTeX writers adjusted.
The special characters are '<','>','|','"','{','}','[',']','^', '`'.

Closes #1640, #2377.
1e8a25a
@jgm
Owner

Closed by 1e8a25a

@jgm jgm closed this
@adunning

Thanks for taking care of this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.