Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop XML escaping the body of a link. #319

Merged
merged 1 commit into from Jan 23, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/markdown2.py
Expand Up @@ -1408,7 +1408,7 @@ def _do_links(self, text):
result_head = '<a href="#"%s>' % (title_str)
else:
result_head = '<a href="%s"%s>' % (_html_escape_url(url, safe_mode=self.safe_mode), title_str)
result = '%s%s</a>' % (result_head, _xml_escape_attr(link_text))
result = '%s%s</a>' % (result_head, link_text)
if "smarty-pants" in self.extras:
result = result.replace('"', self._escape_table['"'])
# <img> allowed from curr_pos on, <a> from
Expand Down
4 changes: 3 additions & 1 deletion test/tm-cases/inline_links.html
@@ -1,6 +1,8 @@
<p>an inline <a href="/url/">link</a></p>

<p>a <a href="/url/" title="title">link &quot;with&quot; title</a></p>
<p>a <a href="/url/" title="title">link "with" title</a></p>

<p>an inline <a href="/url/">link with <code>code</code></a></p>

<p>an inline <img src="/url/" alt="image link" /></p>

Expand Down
2 changes: 2 additions & 0 deletions test/tm-cases/inline_links.text
Expand Up @@ -2,6 +2,8 @@ an inline [link](/url/)

a [link "with" title](/url/ "title")

an inline [link with `code`](/url/)

an inline ![image link](/url/)

an ![image "with" title](/url/ "title")
6 changes: 3 additions & 3 deletions test/tm-cases/long_link.html
@@ -1,12 +1,12 @@
<h1>works</h1>

<p><a href="http://tuxdeluxe.org/node/287">wever installation of Kunnafonix was resisted by many of the local organizations they had to work with The local &quot;computer person&quot; resented a solution that was so easy to use that it undermined the power and prestige they received by being the person to consult when a Windows computer had problems</a></p>
<p><a href="http://tuxdeluxe.org/node/287">wever installation of Kunnafonix was resisted by many of the local organizations they had to work with The local "computer person" resented a solution that was so easy to use that it undermined the power and prestige they received by being the person to consult when a Windows computer had problems</a></p>

<h1>issue 24: these fail</h1>

<p><a href="http://tuxdeluxe.org/node/287">wever installation of Kunnafonix was resisted by many of the local organizations they had to
work with The local &quot;computer person&quot; resented a solution that was so easy to use that it undermined
work with The local "computer person" resented a solution that was so easy to use that it undermined
the power and prestige they received by being the person to consult when a Windows computer had
problems</a></p>

<p><a href="http://tuxdeluxe.org/node/287">However installation of Kunnafonix was resisted by many of the local organizations they had to work with The local &quot;computer person&quot; resented a solution that was so easy to use that it undermined the power and prestige they received by being the person to consult when a Windows computer had problems</a></p>
<p><a href="http://tuxdeluxe.org/node/287">However installation of Kunnafonix was resisted by many of the local organizations they had to work with The local "computer person" resented a solution that was so easy to use that it undermined the power and prestige they received by being the person to consult when a Windows computer had problems</a></p>