lib/autolink.rb
# Add <tt><a></a></tt> tags around the URLs in the provided <tt>text</tt>.
# Any elements in the <tt>href_options</tt> hash will be converted to HTML
# attributes and place in the <tt><a></tt> tag. Unless <tt>href_options</tt>
# contains <tt>:suppress_no_follow</tt> the <tt>rel="nofollow"</tt>
# attribute will be added.
Add  tags around the URLs in the provided text.
Any elements in the href_options hash will be converted to HTML
attributes and place in the  tag. Unless href_options
contains :suppress_no_follow the rel="nofollow"
attribute will be added.
Add tags around the URLs in the provided text . Any elements in the href_options hash will be converted to HTML attributes and place in the tag . Unless href_options contains : suppress_no_follow the rel = " nofollow " attribute will be added .
def auto_link_urls_custom(text, href_options = {})
      options = href_options.dup
      options[:rel] = "nofollow" unless options.delete(:suppress_no_follow)
      text.gsub(Twitter::Regex[:valid_url]) do
        all, before, url, protocol, domain, path, query_string = $1, $2, $3, $4, $5, $6, $7
        if !protocol.blank?
          html_attrs = tag_options(options.stringify_keys) || ""
          "#{before}<a href=\"#{html_escape(url)}\"#{html_attrs}>#{html_escape(url)}</a>"
        else
          all
        end
      end
    end
def auto_link_urls_custom ( text , href_options = { } ) options = href_options . dup options [ :rel ] = "nofollow" unless options . delete ( :suppress_no_follow ) text . gsub ( Twitter :: Regex [ :valid_url ] ) do all , before , url , protocol , domain , path , query_string = $1 , $2 , $3 , $4 , $5 , $6 , $7 if ! protocol . blank? html_attrs = tag_options ( options . stringify_keys ) || "" "#{before}<a href=\"#{html_escape(url)}\"#{html_attrs}>#{html_escape(url)}</a>" else all end end end
Add <tt><a></a></tt> tags around the URLs in the provided <tt>text</tt>.
Add <tt > <a > < / a > < / tt > tags around the URLs in the provided <tt > text< / tt > .
text
href_options