comparison test/test_templating.py @ 6274:474de62f4ce0

Add test for hard linebreak fomatting in markdown issue2551094 proposes making any newline into a hard linebreak in the html. This is not markdown standard. Standard is two trailing spaces on a line followed by newline. Test that all formatters support it.
author John Rouillard <rouilj@ieee.org>
date Thu, 22 Oct 2020 11:49:14 -0400
parents b108c9fc7aea
children bda491248fd8
comparison
equal deleted inserted replaced
6273:d0a75dc269e5 6274:474de62f4ce0
445 self.assertTrue(p.markdown().find('href="javascript:') == -1) 445 self.assertTrue(p.markdown().find('href="javascript:') == -1)
446 446
447 p = StringHTMLProperty(self.client, 'test', '1', None, 'test', u2s(u'[link](javascript:alert(1))')) 447 p = StringHTMLProperty(self.client, 'test', '1', None, 'test', u2s(u'[link](javascript:alert(1))'))
448 self.assertTrue(p.markdown().find('href="javascript:') == -1) 448 self.assertTrue(p.markdown().find('href="javascript:') == -1)
449 449
450
451 def test_string_markdown_forced_line_break(self):
452 p = StringHTMLProperty(self.client, 'test', '1', None, 'test', u2s(u'This is a set of text \n:that should have a break \n:at newlines. Each \n:colon should be the start of an html line'))
453 # sigh different backends render this differently:
454 # of text <br />
455 # of text<br>
456 # etc.
457 # Rather than using a different result for each
458 # renderer, look for '<br' and require three of them.
459 m = p.markdown()
460 self.assertEqual(3, m.count('<br'))
461
450 def test_string_markdown_code_block(self): 462 def test_string_markdown_code_block(self):
451 p = StringHTMLProperty(self.client, 'test', '1', None, 'test', u2s(u'embedded code block\n\n```\nline 1\nline 2\n```\n\nnew paragraph')) 463 p = StringHTMLProperty(self.client, 'test', '1', None, 'test', u2s(u'embedded code block\n\n```\nline 1\nline 2\n```\n\nnew paragraph'))
452 self.assertEqual(p.markdown().strip().replace('\n\n', '\n'), u2s(u'<p>embedded code block</p>\n<pre><code>line 1\nline 2\n</code></pre>\n<p>new paragraph</p>')) 464 self.assertEqual(p.markdown().strip().replace('\n\n', '\n'), u2s(u'<p>embedded code block</p>\n<pre><code>line 1\nline 2\n</code></pre>\n<p>new paragraph</p>'))
453 465
454 @skip_mistune 466 @skip_mistune

Roundup Issue Tracker: http://roundup-tracker.org/