original_docstring:  Surrounds urls with url bbcode tags. 
docstring: Surrounds urls with url bbcode tags.
docstring_tokens: Surrounds urls with url bbcode tags .
code: def tagify_urls(self, postmarkup):
  
          """ Surrounds urls with url bbcode tags. """
  
          def repl(match):
              return u'[url]%s[/url]' % match.group(0)
  
          text_tokens = []
          append = text_tokens.append
          sub = _re_url.sub
          TOKEN_TEXT = PostMarkup.TOKEN_TEXT
          enclosed = False
          tag_factory = self.tag_factory
          
          enclosed_tags = defaultdict(int)
          for tag_type, tag_token, start_pos, end_pos in self.tokenize(postmarkup):                        
              if tag_type == TOKEN_TEXT:
                  if enclosed:
                      append(tag_token)
                  else:                
                      append(sub(repl, tag_token))                
              else:
                  tag_name, _tag_attribs, end_tag = self.parse_tag_token(tag_token)
                  
                  tag = tag_factory.get(tag_name)                
                  if tag is not None and tag.enclosed:
                      if end_tag:                        
                          if tag_name in enclosed_tags:
                              enclosed_tags[tag_name] -= 1
                              if enclosed_tags[tag_name] == 0:
                                  del enclosed_tags[tag_name]
                              enclosed = bool(enclosed_tags)
                      else:
                          enclosed_tags[tag_name] += 1
                          enclosed = True
                          
                  append(tag_token)
  
          return u"".join(text_tokens)
code_tokens: def tagify_urls ( self , postmarkup ) : def repl ( match ) : return u'[url]%s[/url]' % match . group ( 0 ) text_tokens = [ ] append = text_tokens . append sub = _re_url . sub TOKEN_TEXT = PostMarkup . TOKEN_TEXT enclosed = False tag_factory = self . tag_factory enclosed_tags = defaultdict ( int ) for tag_type , tag_token , start_pos , end_pos in self . tokenize ( postmarkup ) : if tag_type == TOKEN_TEXT : if enclosed : append ( tag_token ) else : append ( sub ( repl , tag_token ) ) else : tag_name , _tag_attribs , end_tag = self . parse_tag_token ( tag_token ) tag = tag_factory . get ( tag_name ) if tag is not None and tag . enclosed : if end_tag : if tag_name in enclosed_tags : enclosed_tags [ tag_name ] -= 1 if enclosed_tags [ tag_name ] == 0 : del enclosed_tags [ tag_name ] enclosed = bool ( enclosed_tags ) else : enclosed_tags [ tag_name ] += 1 enclosed = True append ( tag_token ) return u"" . join ( text_tokens )
short_docstring: Surrounds urls with url bbcode tags.
short_docstring_tokens: Surrounds urls with url bbcode tags .
comment: """ Surrounds urls with url bbcode tags. """