bugdown: TLD and parentheses shouldn't make it a link. Trac #1364

(imported from commit d4da7ec080a6a8362b6370ced9ddc10d52443452)
This commit is contained in:
Kevin Mehall 2013-06-14 16:53:49 -04:00
parent 11e44c68ce
commit 334424ae79
2 changed files with 6 additions and 2 deletions

View File

@ -565,7 +565,7 @@ class Bugdown(markdown.Extension):
# This rule must come after the http_autolink rule we add above to avoid double # This rule must come after the http_autolink rule we add above to avoid double
# linkifying. # linkifying.
tlds = '|'.join(list_of_tlds()) tlds = '|'.join(list_of_tlds())
link_regex = r"\b(?P<url>[^\s]+\.(%s)(?:/[^\s()\":]*?|([^\s()\":]*\([^\s()\":]*\)[^\s()\":]*))?)(?=([:;\?\),\.\'\"]\Z|[:;\?\),\.\'\"]\s|\Z|\s))" % (tlds,) link_regex = r"\b(?P<url>[^\s]+\.(%s)(?:/[^\s()\":]*?|(/[^\s()\":]*\([^\s()\":]*\)[^\s()\":]*))?)(?=([:;\?\),\.\'\"]\Z|[:;\?\),\.\'\"]\s|\Z|\s))" % (tlds,)
md.inlinePatterns.add('autolink', AutoLink(link_regex), '>http_autolink') md.inlinePatterns.add('autolink', AutoLink(link_regex), '>http_autolink')
md.preprocessors.add('hanging_ulists', md.preprocessors.add('hanging_ulists',

View File

@ -2139,7 +2139,11 @@ int x = 3
# to avoid triggering the inline image preview support # to avoid triggering the inline image preview support
('http://technet.microsoft.com/en-us/library/Cc751099.rk20_25_big(l=en-us).mov', ('http://technet.microsoft.com/en-us/library/Cc751099.rk20_25_big(l=en-us).mov',
"<p>%s</p>", "<p>%s</p>",
'http://technet.microsoft.com/en-us/library/Cc751099.rk20_25_big(l=en-us).mov')] 'http://technet.microsoft.com/en-us/library/Cc751099.rk20_25_big(l=en-us).mov'),
# Just because it has a TLD and parentheses in it doesn't mean it's a link. Trac #1364
('a.commandstuff()', '<p>a.commandstuff()</p>', ''),
]
for inline_url, reference, url in conversions: for inline_url, reference, url in conversions:
try: try: