##// END OF EJS Templates
Merged r14237 (#19735)....
Jean-Philippe Lang -
r13866:b8811f47ccf5
parent child
Show More
@@ -135,7 +135,7 module Redmine
135
135
136 # Destructively replaces email addresses into clickable links
136 # Destructively replaces email addresses into clickable links
137 def auto_mailto!(text)
137 def auto_mailto!(text)
138 text.gsub!(/([\w\.!#\$%\-+.]+@[A-Za-z0-9\-]+(\.[A-Za-z0-9\-]+)+)/) do
138 text.gsub!(/([\w\.!#\$%\-+.\/]+@[A-Za-z0-9\-]+(\.[A-Za-z0-9\-]+)+)/) do
139 mail = $1
139 mail = $1
140 if text.match(/<a\b[^>]*>(.*)(#{Regexp.escape(mail)})(.*)<\/a>/)
140 if text.match(/<a\b[^>]*>(.*)(#{Regexp.escape(mail)})(.*)<\/a>/)
141 mail
141 mail
@@ -48,6 +48,12 EXPECTED
48 assert_equal expected.gsub(%r{[\r\n\t]}, ''), Redmine::WikiFormatting::NullFormatter::Formatter.new(raw).to_html.gsub(%r{[\r\n\t]}, '')
48 assert_equal expected.gsub(%r{[\r\n\t]}, ''), Redmine::WikiFormatting::NullFormatter::Formatter.new(raw).to_html.gsub(%r{[\r\n\t]}, '')
49 end
49 end
50
50
51 def test_should_link_email_with_slashes
52 raw = 'foo/bar@example.net'
53 expected = '<p><a class="email" href="mailto:foo/bar@example.net">foo/bar@example.net</a></p>'
54 assert_equal expected.gsub(%r{[\r\n\t]}, ''), Redmine::WikiFormatting::NullFormatter::Formatter.new(raw).to_html.gsub(%r{[\r\n\t]}, '')
55 end
56
51 def test_links_separated_with_line_break_should_link
57 def test_links_separated_with_line_break_should_link
52 raw = <<-DIFF
58 raw = <<-DIFF
53 link: https://www.redmine.org
59 link: https://www.redmine.org
General Comments 0
You need to be logged in to leave comments. Login now