mirror of
https://github.com/discourse/discourse.git
synced 2025-09-05 08:59:27 +08:00
FIX: Email cooker should support links within blockquotes
This commit is contained in:
parent
6db50b820d
commit
12cfc8cedd
2 changed files with 13 additions and 4 deletions
|
@ -17,6 +17,13 @@ class EmailCook
|
|||
end
|
||||
end
|
||||
|
||||
def link_string!(str)
|
||||
str.scan(EmailCook.url_regexp).each do |m|
|
||||
url = m[0]
|
||||
str.gsub!(url, "<a href='#{url}'>#{url}</a>")
|
||||
end
|
||||
end
|
||||
|
||||
def cook
|
||||
result = ""
|
||||
|
||||
|
@ -28,6 +35,7 @@ class EmailCook
|
|||
|
||||
if l =~ /^\s*>/
|
||||
in_quote = true
|
||||
link_string!(l)
|
||||
quote_buffer << l.sub(/^[\s>]*/, '') << "<br>"
|
||||
elsif in_quote
|
||||
add_quote(result, quote_buffer)
|
||||
|
@ -37,10 +45,7 @@ class EmailCook
|
|||
|
||||
sz = l.size
|
||||
|
||||
l.scan(EmailCook.url_regexp).each do |m|
|
||||
url = m[0]
|
||||
l.gsub!(url, "<a href='#{url}'>#{url}</a>")
|
||||
end
|
||||
link_string!(l)
|
||||
|
||||
result << l
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue