Add auto link support to the email formatter
This commit is contained in:
parent
971af6a762
commit
d9997a6b9e
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue