diff --git a/lib/redmine/wiki_formatting.rb b/lib/redmine/wiki_formatting.rb index 284cdc933..b1085a74a 100644 --- a/lib/redmine/wiki_formatting.rb +++ b/lib/redmine/wiki_formatting.rb @@ -94,7 +94,7 @@ module Redmine module LinksHelper AUTO_LINK_RE = %r{ ( # leading text - <\w+.*?>| # leading HTML tag, or + <\w+[^>]*?>| # leading HTML tag, or [\s\(\[,;]| # leading punctuation, or ^ # beginning of line ) @@ -113,8 +113,12 @@ module Redmine # Destructively replaces urls into clickable links def auto_link!(text) + Rails.logger.debug "=====================" + Rails.logger.debug text + Rails.logger.debug "=====================" text.gsub!(AUTO_LINK_RE) do all, leading, proto, url, post = $&, $1, $2, $3, $6 + Rails.logger.debug all if leading =~ /=]?/ # don't replace URLs that are already linked # and URLs prefixed with ! !> !< != (textile images) diff --git a/test/unit/lib/redmine/wiki_formatting_test.rb b/test/unit/lib/redmine/wiki_formatting_test.rb index 830ab20ca..05c0f5e1d 100644 --- a/test/unit/lib/redmine/wiki_formatting_test.rb +++ b/test/unit/lib/redmine/wiki_formatting_test.rb @@ -48,6 +48,19 @@ EXPECTED assert_equal expected.gsub(%r{[\r\n\t]}, ''), Redmine::WikiFormatting::NullFormatter::Formatter.new(raw).to_html.gsub(%r{[\r\n\t]}, '') end + def test_links_separated_with_line_break_should_link + raw = <<-DIFF +link: https://www.redmine.org +http://www.redmine.org +DIFF + + expected = <<-EXPECTED +

link: https://www.redmine.org
+http://www.redmine.org

+EXPECTED + + end + def test_supports_section_edit with_settings :text_formatting => 'textile' do assert_equal true, Redmine::WikiFormatting.supports_section_edit?