David Cramer  committed 6180cb2

Only auto link relative urls that start with www.

  • Participants
  • Parent commits 24e987c

Comments (0)

Files changed (1)

File bbcode/bbtags/

 class AutoDetectURL(SelfClosingTagNode):
+    # XXX: might be better to enumerate words rather than use regexp?
     open_pattern = re.compile(r'(?P<before>[^[\]])(?P<url>(?P<protocol>(?:ht|f)tp(?:s?)\:\/\/|~/|/'
                               's)(?:(?:[-\w]+\.)+(?#TopLevel Domains)(?:com|org'
         match = self.match.groupdict()
         match['label'] = match['url']
         if not match.get('protocol'):
+            # if its not www we dont link it
+            if not match['url'].lower().startswith('www.'):
+                return '%(before)s%(label)s%(after)s' % match
             match['url'] = 'http://' + match['url']
         return '%(before)s<a href="%(url)s">%(label)s</a>%(after)s' % match