def urls(text)
      
      text.gsub(@regex[:protocol]) do
        scheme, href = $1, $&
        punctuation = []

        if auto_linked?($`, $')
          # do not change string; URL is already linked
          href
        else
          # don't include trailing punctuation character as part of the URL
          while href.sub!(/[^#{@regex[:word_pattern]}\/-]$/, '')
            punctuation.push $&
            if opening = @regex[:brackets][punctuation.last] and href.scan(opening).size > href.scan(punctuation.last).size
              href << punctuation.pop
              break
            end
          end

          link_text = block_given?? yield(href) : href
          href = '//' + href unless scheme

          "<a href='#{href}' target='_blank'>#{link_text}</a>" + punctuation.reverse.join('')
        end
      end
    end
def urls(text)
      
      text.gsub(@regex[:protocol]) do
        scheme, href = $1, $&
        punctuation = []

        if auto_linked?($`, $')
          # do not change string; URL is already linked
          href
        else
          # don't include trailing punctuation character as part of the URL
          while href.sub!(/[^#{@regex[:word_pattern]}\/-]$/, '')
            punctuation.push $&
            if opening = @regex[:brackets][punctuation.last] and href.scan(opening).size > href.scan(punctuation.last).size
              href << punctuation.pop
              break
            end
          end

          link_text = block_given?? yield(href) : href
          href = '//' + href unless scheme

          "<a href='#{href}' target='_blank'>#{link_text}</a>" + punctuation.reverse.join('')
        end
      end
    end
Turns all urls into clickable links.  If a block is given, each url
 is yielded and the result is used as the link text.