bugdown: Start a URL with a word boundary, not a space

This fixes the bug where we were eating the preceding space.

(imported from commit 9eca01e6ad828ccc31ad10693339f381333e76a7)
This commit is contained in:
Keegan McAllister 2012-10-22 17:24:12 -04:00
parent 0f474285bf
commit 1c4bbd6a49
1 changed files with 1 additions and 1 deletions

View File

@ -33,7 +33,7 @@ class Bugdown(markdown.Extension):
md.inlinePatterns.add('gravatar', Gravatar(r'!gravatar\((?P<email>[^)]*)\)'), '_begin') md.inlinePatterns.add('gravatar', Gravatar(r'!gravatar\((?P<email>[^)]*)\)'), '_begin')
# A link starts after whitespace and continues to the next whitespace. # A link starts after whitespace and continues to the next whitespace.
link_regex = r'(\s|\A)(?P<url>https?://[^\s]+)' link_regex = r'\b(?P<url>https?://[^\s]+)'
md.inlinePatterns.add('autolink', AutoLink(link_regex), '_begin') md.inlinePatterns.add('autolink', AutoLink(link_regex), '_begin')
# We need to re-initialize the markdown engine every 30 messages # We need to re-initialize the markdown engine every 30 messages