Commits

David Cramer committed c8a09d3

once again disable auto linking as it breaks single argument tags

Comments (0)

Files changed (2)

bbcode/__init__.py

     """
     no_argument = r'\[%s\]'
     self_closing_tag = r'\[%s\s*/\]'
-    single_argument = r'\[%s(\]|="?(?P<argument>[^\]]+)"?\])'
+    single_argument = r'\[%s(?:\]|="?(?P<argument>[^\]"]+)"?\])'
     argument = r'( (\w+)=([^\] ]+))?'
     closing = r'\[/%s\]'
     unmatchable = UnmatchablePseudoPattern()

bbcode/bbtags/web.py

     
     def parse(self):
         inner = ''
-        for node in self.nodes:    
+        for node in self.nodes:
             if node.is_text_node or isinstance(node, AutoDetectURL):
                 inner += node.raw_content
             else:
-                soft_raise("Img tag cannot have nested tags without an argument.")
+                soft_raise("Img tag cannot have nested tags")
                 return self.raw_content
         inner = self.variables.resolve(inner)
         if self.argument:
     
 class AutoDetectURL(SelfClosingTagNode):
     # XXX: might be better to enumerate words rather than use regexp?
-    #open_pattern = re.compile(r'(?P<before>[^\]])(?P<url>(?:http|ftp|https)://[\w\-_]+(?:\.[\w\-_]+)+(?:[\w\-\.,@?^=%&amp;:/~\+#]*[\w\-\@?^=%&amp;/~\+#])?', re.I)
     open_pattern = re.compile(r'(?P<before>[^\]=])(?P<url>(?:(?P<protocol>https?|ftp)://(?:\w+@)?|www\.)[\w.-]+(?:/\S+)?)(?P<after>\b)', re.I)
-    # 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'
-    #                           '|travel|[a-z]{2}))(?#Port)(?::[\d]{1,5})?(?#Dire'
-    #                           'ctories)(?:(?:(?:/(?:[-\w~!$+|.,=]|%[a-f\d]{2})+'
-    #                           ')+|/)+|\?|#)?(?#Query)(?:(?:\?(?:[-\w~!$+|.,*:]|'
-    #                           '%[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>[^\s\[])', re.I)
     
     def parse(self):
         match = self.match.groupdict()
 register(Img)
 register(Email)
 register(Youtube)
-register(AutoDetectURL)
+#register(AutoDetectURL)