Mercurial > p > roundup > code
diff test/test_templating.py @ 6103:af16c135fb98
url's with javascript scheme should not be links in reST
A javascript url in a reStructuredText document should not be
displayed as a link. So:
javascript:nastyJavascriptCode
should be displayed as text and not a link.
We do this by stripping the scheme from the schemes array in
docutils.utils.urischemes. We set a property on the
StringHTMLProperty to hold the list of schemes we want to disable so
the user can choose to change it if they want.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Tue, 25 Feb 2020 22:48:17 -0500 |
| parents | 55c56ceacb8e |
| children | a1fd9551d416 |
line wrap: on
line diff
--- a/test/test_templating.py Tue Feb 25 16:36:18 2020 +0000 +++ b/test/test_templating.py Tue Feb 25 22:48:17 2020 -0500 @@ -281,9 +281,14 @@ </div> </div> ''' + # test case to make sure javascript url's aren't turned into links + s = StringHTMLProperty(self.client, 'test', '1', None, 'test', u2s(u'<badtag>\njavascript:badcode')) + s_result = '<div class="document">\n<p><badtag>\njavascript:badcode</p>\n</div>\n' + self.assertEqual(p.rst(), u2s(u'<div class="document">\n<p>A string with <a class="reference external" href="mailto:cmeerw@example.com">cmeerw@example.com</a> <em>embedded</em> \u00df</p>\n</div>\n')) self.assertEqual(q.rst(), u2s(q_result)) self.assertEqual(r.rst(), u2s(r_result)) + self.assertEqual(s.rst(), u2s(s_result)) @skip_stext def test_string_stext(self):
