Skip to content

Instantly share code, notes, and snippets.

@readevalprint
Created September 8, 2011 17:16
Show Gist options
  • Save readevalprint/1203968 to your computer and use it in GitHub Desktop.
Save readevalprint/1203968 to your computer and use it in GitHub Desktop.
html comments to stop links
class ArticlePreviewTests(TestCaseBase):
#.....
def test_comments_no_linkify(self):
d = _create_document(title='Template:Foo')
revision(document=d,
is_approved=True,
is_ready_for_localization=True,
save=True,
content='iamalink.com imnotalink.<!-- -->com')
# preview wiki to assert the link is a link
url = reverse('wiki.preview')
response = self.client.post(url, {'content': '[[Template:Foo]]'})
eq_(200, response.status_code)
doc = pq(response.content)
eq_(u'<a href="http://iamalink.com">iamalink.com</a>'
u' imnotalink.com\n\n',
doc('p').html())
# output: u'<a href="http://iamalink.com">iamalink.com</a> <a href="http://imnotalink.com">imnotalink.com</a>\n\n
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment