Sha256: f32c48ceefa4075461f5d83debda77f6140f3b9f35cf914a63eab8dd36d79e6f
Contents?: true
Size: 494 Bytes
Versions: 4
Compression:
Stored size: 494 Bytes
Contents
AutoHtml.add_filter(:link).with({}) do |text, options| require 'uri' require 'rinku' require 'rexml/document' option_short_link_name = options.delete(:short_link_name) attributes = Array(options).reject { |k,v| v.nil? }.map { |k, v| %{#{k}="#{REXML::Text::normalize(v)}"} }.join(' ') Rinku.auto_link(text, :all, attributes) do |url| if option_short_link_name uri = URI.parse(URI.encode(url.strip)) uri.query = nil uri.to_s else url end end end
Version data entries
4 entries across 4 versions & 2 rubygems