Add auto link support to the email formatter

This commit is contained in:
Robin Ward 2015-10-28 13:31:28 -04:00
parent 971af6a762
commit d9997a6b9e
1 changed files with 7 additions and 0 deletions

View File

@ -1,4 +1,7 @@
# A very simple formatter for imported emails
require 'uri'
class EmailCook
def initialize(raw)
@ -30,6 +33,10 @@ class EmailCook
result.gsub!(/(<br>){3,10}/, '<br><br>')
URI.extract(result).each do |m|
result.gsub!(m, "<a href='#{m}'>#{m}</a>")
end
result
end