@@ -94,7 +94,7 module Redmine | |||||
94 | module LinksHelper |
|
94 | module LinksHelper | |
95 | AUTO_LINK_RE = %r{ |
|
95 | AUTO_LINK_RE = %r{ | |
96 | ( # leading text |
|
96 | ( # leading text | |
97 |
<\w+ |
|
97 | <\w+[^>]*?>| # leading HTML tag, or | |
98 | [\s\(\[,;]| # leading punctuation, or |
|
98 | [\s\(\[,;]| # leading punctuation, or | |
99 | ^ # beginning of line |
|
99 | ^ # beginning of line | |
100 | ) |
|
100 | ) | |
@@ -113,8 +113,12 module Redmine | |||||
113 |
|
113 | |||
114 | # Destructively replaces urls into clickable links |
|
114 | # Destructively replaces urls into clickable links | |
115 | def auto_link!(text) |
|
115 | def auto_link!(text) | |
|
116 | Rails.logger.debug "=====================" | |||
|
117 | Rails.logger.debug text | |||
|
118 | Rails.logger.debug "=====================" | |||
116 | text.gsub!(AUTO_LINK_RE) do |
|
119 | text.gsub!(AUTO_LINK_RE) do | |
117 | all, leading, proto, url, post = $&, $1, $2, $3, $6 |
|
120 | all, leading, proto, url, post = $&, $1, $2, $3, $6 | |
|
121 | Rails.logger.debug all | |||
118 | if leading =~ /<a\s/i || leading =~ /![<>=]?/ |
|
122 | if leading =~ /<a\s/i || leading =~ /![<>=]?/ | |
119 | # don't replace URLs that are already linked |
|
123 | # don't replace URLs that are already linked | |
120 | # and URLs prefixed with ! !> !< != (textile images) |
|
124 | # and URLs prefixed with ! !> !< != (textile images) |
@@ -48,6 +48,19 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_links_separated_with_line_break_should_link | |||
|
52 | raw = <<-DIFF | |||
|
53 | link: https://www.redmine.org | |||
|
54 | http://www.redmine.org | |||
|
55 | DIFF | |||
|
56 | ||||
|
57 | expected = <<-EXPECTED | |||
|
58 | <p>link: <a class="external" href="https://www.redmine.org">https://www.redmine.org</a><br /> | |||
|
59 | <a class="external" href="http://www.redmine.org">http://www.redmine.org</a></p> | |||
|
60 | EXPECTED | |||
|
61 | ||||
|
62 | end | |||
|
63 | ||||
51 | def test_supports_section_edit |
|
64 | def test_supports_section_edit | |
52 | with_settings :text_formatting => 'textile' do |
|
65 | with_settings :text_formatting => 'textile' do | |
53 | assert_equal true, Redmine::WikiFormatting.supports_section_edit? |
|
66 | assert_equal true, Redmine::WikiFormatting.supports_section_edit? |
General Comments 0
You need to be logged in to leave comments.
Login now