@@ -825,7 +825,7 class RedCloth3 < String | |||
|
825 | 825 | post = ")"+post # add closing parenth to post |
|
826 | 826 | end |
|
827 | 827 | atts = pba( atts ) |
|
828 | atts = " href=\"#{ url }#{ slash }\"#{ atts }" | |
|
828 | atts = " href=\"#{ htmlesc url }#{ slash }\"#{ atts }" | |
|
829 | 829 | atts << " title=\"#{ htmlesc title }\"" if title |
|
830 | 830 | atts = shelve( atts ) if atts |
|
831 | 831 |
@@ -21,6 +21,7 module Redmine | |||
|
21 | 21 | module WikiFormatting |
|
22 | 22 | module Textile |
|
23 | 23 | class Formatter < RedCloth3 |
|
24 | include ActionView::Helpers::TagHelper | |
|
24 | 25 | |
|
25 | 26 | # auto_link rule after textile rules so that it doesn't break !image_url! tags |
|
26 | 27 | RULES = [:textile, :block_markdown_rule, :inline_auto_link, :inline_auto_mailto, :inline_toc] |
@@ -134,7 +135,8 module Redmine | |||
|
134 | 135 | url=url[0..-2] # discard closing parenth from url |
|
135 | 136 | post = ")"+post # add closing parenth to post |
|
136 | 137 | end |
|
137 |
|
|
|
138 | tag = content_tag('a', proto + url, :href => "#{proto=="www."?"http://www.":proto}#{url}", :class => 'external') | |
|
139 | %(#{leading}#{tag}#{post}) | |
|
138 | 140 | end |
|
139 | 141 | end |
|
140 | 142 | end |
@@ -146,7 +148,7 module Redmine | |||
|
146 | 148 | if text.match(/<a\b[^>]*>(.*)(#{Regexp.escape(mail)})(.*)<\/a>/) |
|
147 | 149 | |
|
148 | 150 | else |
|
149 |
|
|
|
151 | content_tag('a', mail, :href => "mailto:#{mail}", :class => "email") | |
|
150 | 152 | end |
|
151 | 153 | end |
|
152 | 154 | end |
@@ -60,12 +60,14 class ApplicationHelperTest < HelperTestCase | |||
|
60 | 60 | 'sftp://foo.bar' => '<a class="external" href="sftp://foo.bar">sftp://foo.bar</a>', |
|
61 | 61 | # two exclamation marks |
|
62 | 62 | 'http://example.net/path!602815048C7B5C20!302.html' => '<a class="external" href="http://example.net/path!602815048C7B5C20!302.html">http://example.net/path!602815048C7B5C20!302.html</a>', |
|
63 | # escaping | |
|
64 | 'http://foo"bar' => '<a class="external" href="http://foo"bar">http://foo"bar</a>', | |
|
63 | 65 | } |
|
64 | 66 | to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text) } |
|
65 | 67 | end |
|
66 | 68 | |
|
67 | 69 | def test_auto_mailto |
|
68 |
assert_equal '<p><a href="mailto:test@foo.bar |
|
|
70 | assert_equal '<p><a class="email" href="mailto:test@foo.bar">test@foo.bar</a></p>', | |
|
69 | 71 | textilizable('test@foo.bar') |
|
70 | 72 | end |
|
71 | 73 | |
@@ -130,6 +132,8 RAW | |||
|
130 | 132 | "\"system administrator\":mailto:sysadmin@example.com?subject=redmine%20permissions" => "<a href=\"mailto:sysadmin@example.com?subject=redmine%20permissions\">system administrator</a>", |
|
131 | 133 | # two exclamation marks |
|
132 | 134 | '"a link":http://example.net/path!602815048C7B5C20!302.html' => '<a href="http://example.net/path!602815048C7B5C20!302.html" class="external">a link</a>', |
|
135 | # escaping | |
|
136 | '"test":http://foo"bar' => '<a href="http://foo"bar" class="external">test</a>', | |
|
133 | 137 | } |
|
134 | 138 | to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text) } |
|
135 | 139 | end |
General Comments 0
You need to be logged in to leave comments.
Login now