##// END OF EJS Templates
Fixed that URLs separated by line break are not rendered as links (#18349)....
Jean-Philippe Lang -
r13210:c12ba8a76cfa
parent child
Show More
@@ -94,7 +94,7 module Redmine
94 94 module LinksHelper
95 95 AUTO_LINK_RE = %r{
96 96 ( # leading text
97 <\w+.*?>| # leading HTML tag, or
97 <\w+[^>]*?>| # leading HTML tag, or
98 98 [\s\(\[,;]| # leading punctuation, or
99 99 ^ # beginning of line
100 100 )
@@ -113,8 +113,12 module Redmine
113 113
114 114 # Destructively replaces urls into clickable links
115 115 def auto_link!(text)
116 Rails.logger.debug "====================="
117 Rails.logger.debug text
118 Rails.logger.debug "====================="
116 119 text.gsub!(AUTO_LINK_RE) do
117 120 all, leading, proto, url, post = $&, $1, $2, $3, $6
121 Rails.logger.debug all
118 122 if leading =~ /<a\s/i || leading =~ /![<>=]?/
119 123 # don't replace URLs that are already linked
120 124 # and URLs prefixed with ! !> !< != (textile images)
@@ -48,6 +48,19 EXPECTED
48 48 assert_equal expected.gsub(%r{[\r\n\t]}, ''), Redmine::WikiFormatting::NullFormatter::Formatter.new(raw).to_html.gsub(%r{[\r\n\t]}, '')
49 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 64 def test_supports_section_edit
52 65 with_settings :text_formatting => 'textile' do
53 66 assert_equal true, Redmine::WikiFormatting.supports_section_edit?
General Comments 0
You need to be logged in to leave comments. Login now