Commits

David Cramer  committed 31cf561

More fixes for auto linking

  • Participants
  • Parent commits 73f4d86

Comments (0)

Files changed (1)

File bbcode/bbtags/web.py

     
 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?)\:\/\/|~/|/'
+    open_pattern = re.compile(r'(?P<before>[^\]])(?P<url>(?P<protocol>(?:ht|f)tp(?:s?)\:\/\/|~/|/'
                               ')?(?#Username:Password)(?:\w+:\w+@)?(?#Subdomain'
                               's)(?:(?:[-\w]+\.)+(?#TopLevel Domains)(?:com|org'
                               '|net|gov|mil|biz|info|mobi|name|aero|jobs|museum'
                               '%[a-f\d{2}])+=(?:[-\w~!$+|.,*:=]|%[a-f\d]{2})*)('
                               '?:&(?:[-\w~!$+|.,*:]|%[a-f\d{2}])+=(?:[-\w~!$+|.'
                               ',*:=]|%[a-f\d]{2})*)*)*(?#Anchor)(?:#(?:[-\w~!$+'
-                              '|.,*:=]|%[a-f\d]{2})*)?)(?P<after>[^[\]])', re.I)
+                              '|.,*:=]|%[a-f\d]{2})*)?)(?P<after>[\s\[]*)', re.I)
     
     def parse(self):
         match = self.match.groupdict()