Commit 1084883d authored by maeda's avatar maeda

URLs end with "-" are rendered incorrectly in Textile (#30259).

Patch by Yuichi HARADA.


git-svn-id: https://svn.redmine.org/redmine/trunk@17917 e93f8b46-1217-0410-a6f0-8f06a7374b81
parent e37f5bc7
......@@ -125,7 +125,7 @@ module Redmine
([^<]\S*?) # url
(\/)? # slash
)
((?:&gt;)?|[^[:alnum:]_\=\/;\(\)]*?) # post
((?:&gt;)?|[^[:alnum:]_\=\/;\(\)\-]*?) # post
(?=<|\s|$)
}x unless const_defined?(:AUTO_LINK_RE)
......
......@@ -272,8 +272,8 @@ class RedCloth3 < String
@urlrefs = {}
@shelf = []
textile_rules = [:block_textile_table, :block_textile_lists,
:block_textile_prefix, :inline_textile_image, :inline_textile_link,
:inline_textile_code, :inline_textile_span, :glyphs_textile]
:block_textile_prefix, :inline_textile_image, :inline_textile_code,
:inline_textile_span, :inline_textile_link, :glyphs_textile]
markdown_rules = [:refs_markdown, :block_markdown_setext, :block_markdown_atx, :block_markdown_rule,
:block_markdown_bq, :block_markdown_lists,
:inline_markdown_reflink, :inline_markdown_link]
......@@ -829,7 +829,7 @@ class RedCloth3 < String
[[:alnum:]_\/]\S+?
)
(\/)? # $slash
([^[:alnum:]_\=\/;\(\)]*?) # $post
([^[:alnum:]_\=\/;\(\)\-]*?) # $post
)
(?=<|\s|$)
/x
......
......@@ -94,6 +94,8 @@ class ApplicationHelperTest < Redmine::HelperTest
'http://' => 'http://',
'www.' => 'www.',
'test-www.bar.com' => 'test-www.bar.com',
# ends with a hyphen
'http://www.redmine.org/example-' => '<a class="external" href="http://www.redmine.org/example-">http://www.redmine.org/example-</a>',
}
to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text) }
end
......@@ -270,7 +272,10 @@ RAW
'"a link":http://example.net/path!602815048C7B5C20!302.html' => '<a href="http://example.net/path!602815048C7B5C20!302.html" class="external">a link</a>',
# escaping
'"test":http://foo"bar' => '<a href="http://foo&quot;bar" class="external">test</a>',
}
# ends with a hyphen
'(see "inline link":http://www.foo.bar/Test-)' => '(see <a href="http://www.foo.bar/Test-" class="external">inline link</a>)',
'http://foo.bar/page?p=1&t=z&s=-' => '<a class="external" href="http://foo.bar/page?p=1&#38;t=z&#38;s=-">http://foo.bar/page?p=1&#38;t=z&#38;s=-</a>',
'This is an intern "link":/foo/bar-' => 'This is an intern <a href="/foo/bar-">link</a>', }
to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text) }
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment