URLs in a['href'] should be escaped for LaTeX #67

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
3 participants
Contributor

hperl commented Jul 16, 2013

An URL such as in a a['href'] can contain URL escape codes, which all start with a %. The LaTeX-converter should escape all % to \% using escape(), or otherwise the unescaped % will be treated like a comment in LaTeX, corrupting the file.

This pull request fixes this by calling escape() on the URL.

gettalong was assigned Jul 29, 2013

Owner

gettalong commented Aug 21, 2013

Thanks!

gettalong closed this Aug 21, 2013

I think this is actually wrong, escaping breaks for instance urls with a tilde in them. The hyperref manual says that " The special characters # and ̃ do not need to be escaped in any way.". Unfortunately, it does not say anything about other characters...

Owner

gettalong commented Sep 28, 2016

@mkamensky Thanks for your comment - do you have any test cases for this?

Yes, this comes from my real life example:

echo '<https://www.math.bgu.ac.il/~amyekut/teaching/2016-17/der-cats-III/course_page.html>' | ruby -rkramdown -e 'puts Kramdown::Document.new(ARGF.read).to_latex'

It produces

\href{https://www.math.bgu.ac.il/\ensuremath{\sim}amyekut/teaching/2016-17/der-cats-III/course\_page.html}{https://www.math.bgu.ac.il/\ensuremath{\sim}amyekut/teaching/2016-17/der-cats-III/course\_page.html}

which does not compile. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment