mirror of
https://github.com/discourse/discourse.git
synced 2025-09-05 08:59:27 +08:00
Add auto link support to the email formatter
This commit is contained in:
parent
971af6a762
commit
d9997a6b9e
1 changed files with 7 additions and 0 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue