mirror of
https://github.com/meineerde/redmine.git
synced 2026-04-02 05:51:38 +00:00
Fixed that URLs separated by line break are not rendered as links (#18349).
git-svn-id: http://svn.redmine.org/redmine/trunk@13592 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
429e266bef
commit
c12ba8a76c
@ -94,7 +94,7 @@ module Redmine
|
|||||||
module LinksHelper
|
module LinksHelper
|
||||||
AUTO_LINK_RE = %r{
|
AUTO_LINK_RE = %r{
|
||||||
( # leading text
|
( # leading text
|
||||||
<\w+.*?>| # leading HTML tag, or
|
<\w+[^>]*?>| # leading HTML tag, or
|
||||||
[\s\(\[,;]| # leading punctuation, or
|
[\s\(\[,;]| # leading punctuation, or
|
||||||
^ # beginning of line
|
^ # beginning of line
|
||||||
)
|
)
|
||||||
@ -113,8 +113,12 @@ module Redmine
|
|||||||
|
|
||||||
# Destructively replaces urls into clickable links
|
# Destructively replaces urls into clickable links
|
||||||
def auto_link!(text)
|
def auto_link!(text)
|
||||||
|
Rails.logger.debug "====================="
|
||||||
|
Rails.logger.debug text
|
||||||
|
Rails.logger.debug "====================="
|
||||||
text.gsub!(AUTO_LINK_RE) do
|
text.gsub!(AUTO_LINK_RE) do
|
||||||
all, leading, proto, url, post = $&, $1, $2, $3, $6
|
all, leading, proto, url, post = $&, $1, $2, $3, $6
|
||||||
|
Rails.logger.debug all
|
||||||
if leading =~ /<a\s/i || leading =~ /![<>=]?/
|
if leading =~ /<a\s/i || leading =~ /![<>=]?/
|
||||||
# don't replace URLs that are already linked
|
# don't replace URLs that are already linked
|
||||||
# and URLs prefixed with ! !> !< != (textile images)
|
# and URLs prefixed with ! !> !< != (textile images)
|
||||||
|
|||||||
@ -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]}, '')
|
assert_equal expected.gsub(%r{[\r\n\t]}, ''), Redmine::WikiFormatting::NullFormatter::Formatter.new(raw).to_html.gsub(%r{[\r\n\t]}, '')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_links_separated_with_line_break_should_link
|
||||||
|
raw = <<-DIFF
|
||||||
|
link: https://www.redmine.org
|
||||||
|
http://www.redmine.org
|
||||||
|
DIFF
|
||||||
|
|
||||||
|
expected = <<-EXPECTED
|
||||||
|
<p>link: <a class="external" href="https://www.redmine.org">https://www.redmine.org</a><br />
|
||||||
|
<a class="external" href="http://www.redmine.org">http://www.redmine.org</a></p>
|
||||||
|
EXPECTED
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
def test_supports_section_edit
|
def test_supports_section_edit
|
||||||
with_settings :text_formatting => 'textile' do
|
with_settings :text_formatting => 'textile' do
|
||||||
assert_equal true, Redmine::WikiFormatting.supports_section_edit?
|
assert_equal true, Redmine::WikiFormatting.supports_section_edit?
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user