From 80616d81b326b8d8b484c33c4b5053989f995501 Mon Sep 17 00:00:00 2001 From: Malcolm Rowe Date: Sat, 29 Dec 2018 13:16:26 +0000 Subject: [PATCH] Stop XML escaping the body of a link. This was added as part of 000343d, but isn't necessary for that change, and causes links like [`example`] to render as "<code>...". Fixes #259 --- lib/markdown2.py | 2 +- test/tm-cases/inline_links.html | 4 +++- test/tm-cases/inline_links.text | 2 ++ test/tm-cases/long_link.html | 6 +++--- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/lib/markdown2.py b/lib/markdown2.py index b8e823a6..c572f99f 100755 --- a/lib/markdown2.py +++ b/lib/markdown2.py @@ -1408,7 +1408,7 @@ def _do_links(self, text): result_head = '' % (title_str) else: result_head = '' % (_html_escape_url(url, safe_mode=self.safe_mode), title_str) - result = '%s%s' % (result_head, _xml_escape_attr(link_text)) + result = '%s%s' % (result_head, link_text) if "smarty-pants" in self.extras: result = result.replace('"', self._escape_table['"']) # allowed from curr_pos on, from diff --git a/test/tm-cases/inline_links.html b/test/tm-cases/inline_links.html index b86bd6ac..431e7f1c 100644 --- a/test/tm-cases/inline_links.html +++ b/test/tm-cases/inline_links.html @@ -1,6 +1,8 @@

an inline link

-

a link "with" title

+

a link "with" title

+ +

an inline link with code

an inline image link

diff --git a/test/tm-cases/inline_links.text b/test/tm-cases/inline_links.text index 444a9975..e1f48d59 100644 --- a/test/tm-cases/inline_links.text +++ b/test/tm-cases/inline_links.text @@ -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") diff --git a/test/tm-cases/long_link.html b/test/tm-cases/long_link.html index 34deab2d..bc7ddf2d 100644 --- a/test/tm-cases/long_link.html +++ b/test/tm-cases/long_link.html @@ -1,12 +1,12 @@

works

-

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

+

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

issue 24: these fail

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 +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

-

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

+

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