Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

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

Closed
wants to merge 1 commit into from

2 participants

@hperl

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 gettalong was assigned
@gettalong
Owner

Thanks!

@gettalong gettalong closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jul 16, 2013
  1. @hperl
This page is out of date. Refresh to see the latest.
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/kramdown/converter/latex.rb
View
4 lib/kramdown/converter/latex.rb
@@ -206,9 +206,9 @@ def convert_br(el, opts)
def convert_a(el, opts)
url = el.attr['href']
if url =~ /^#/
- "\\hyperlink{#{url[1..-1]}}{#{inner(el, opts)}}"
+ "\\hyperlink{#{escape(url[1..-1])}}{#{inner(el, opts)}}"
else
- "\\href{#{url}}{#{inner(el, opts)}}"
+ "\\href{#{escape(url)}}{#{inner(el, opts)}}"
end
end
Something went wrong with that request. Please try again.