这是当前在 auto_html.rb 中的代码
标题需要是动态的,基本上是截断 URL 的完整 URL,其中截断 URL 由 auto_link 生成。
AutoHtml.add_filter(:link).with({}) do |text, options|
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|
url.gsub(/https?:\/\//, "").truncate(25)
end
end