bugdown: Disable linebreaks from two spaces at end-of-line.

Arguably the nl2br extension should be doing this for us.  Given that
we're using nl2br, the "two spaces at the end of a line makes a line
break" rule doesn't make any sense (since every newline leads to a
linebreak), so we disable it.

(imported from commit 5ffa2ac8a825642ad31e085c532091e076665710)
This commit is contained in:
Tim Abbott 2013-10-22 13:33:11 -04:00
parent db71931dab
commit b340add1aa
2 changed files with 10 additions and 1 deletions

View File

@ -613,7 +613,7 @@ class Bugdown(markdown.Extension):
for k in ('image_link', 'image_reference', 'automail',
'autolink', 'link', 'reference', 'short_reference',
'escape', 'strong_em', 'emphasis', 'emphasis2',
'strong'):
'linebreak', 'linebreak2', 'strong'):
del md.inlinePatterns[k]
md.preprocessors.add("custom_text_notifications", AlertWordsNotificationProcessor(md), "_end")

View File

@ -3196,6 +3196,15 @@ xxxxxxx</strong></p>\n<p>xxxxxxx xxxxx xxxx xxxxx:<br>\n<code>xxxxxx</code>: xxx
self.assertEqual(converted, '<p>Look at the new dropbox logo: <a href="https://www.dropbox.com/static/images/home_logo.png" target="_blank" title="https://www.dropbox.com/static/images/home_logo.png">https://www.dropbox.com/static/images/home_logo.png</a></p>\n<div class="message_inline_image"><a href="https://www.dropbox.com/static/images/home_logo.png" target="_blank" title="https://www.dropbox.com/static/images/home_logo.png"><img src="https://www.dropbox.com/static/images/home_logo.png"></a></div>')
def test_nl2br(self):
msg = 'test\nbar'
converted = bugdown_convert(msg)
self.assertEqual(converted, '<p>test<br>\nbar</p>')
msg = 'test '
converted = bugdown_convert(msg)
self.assertEqual(converted, '<p>test </p>')
def test_inline_interesting_links(self):
def make_link(url):
return '<a href="%s" target="_blank" title="%s">%s</a>' % (url, url, url)