##// END OF EJS Templates
Better handling of external link style assignment....
Jean-Philippe Lang -
r781:47e7ceacd72d
parent child
Show More
@@ -784,7 +784,9 class RedCloth < String
784 784 atts << " title=\"#{ title }\"" if title
785 785 atts = shelve( atts ) if atts
786 786
787 "#{ pre }<a#{ atts }>#{ text }</a>#{ post }"
787 external = (url =~ /^http:\/\//) ? ' class="external"' : ''
788
789 "#{ pre }<a#{ atts }#{ external }>#{ text }</a>#{ post }"
788 790 end
789 791 end
790 792
@@ -99,7 +99,7 module Redmine
99 99 # and URL's prefixed with ! !> !< != (textile images)
100 100 all
101 101 else
102 %(#{leading}<a href="#{proto=="www."?"http://www.":proto}#{url}">#{proto + url}</a>#{post})
102 %(#{leading}<a class="external" href="#{proto=="www."?"http://www.":proto}#{url}">#{proto + url}</a>#{post})
103 103 end
104 104 end
105 105 end
@@ -278,18 +278,13 div.wiki table, div.wiki td, div.wiki th {
278 278 padding: 4px;
279 279 }
280 280
281 div.wiki a {
281 div.wiki .external {
282 282 background-position: 0% 60%;
283 283 background-repeat: no-repeat;
284 284 padding-left: 12px;
285 285 background-image: url(../images/external.png);
286 286 }
287 287
288 div.wiki a.wiki-page, div.wiki a.issue, div.wiki a.changeset, div.wiki a.email, div.wiki div.toc a {
289 padding-left: 0;
290 background-image: none;
291 }
292
293 288 div.wiki a.new {
294 289 color: #b73535;
295 290 }
@@ -28,12 +28,12 class ApplicationHelperTest < HelperTestCase
28 28
29 29 def test_auto_links
30 30 to_test = {
31 'http://foo.bar' => '<a href="http://foo.bar">http://foo.bar</a>',
32 'http://foo.bar.' => '<a href="http://foo.bar">http://foo.bar</a>.',
33 'http://foo.bar/foo.bar#foo.bar.' => '<a href="http://foo.bar/foo.bar#foo.bar">http://foo.bar/foo.bar#foo.bar</a>.',
34 'www.foo.bar' => '<a href="http://www.foo.bar">www.foo.bar</a>',
35 'http://foo.bar/page?p=1&t=z&s=' => '<a href="http://foo.bar/page?p=1&#38;t=z&#38;s=">http://foo.bar/page?p=1&#38;t=z&#38;s=</a>',
36 'http://foo.bar/page#125' => '<a href="http://foo.bar/page#125">http://foo.bar/page#125</a>'
31 'http://foo.bar' => '<a class="external" href="http://foo.bar">http://foo.bar</a>',
32 'http://foo.bar.' => '<a class="external" href="http://foo.bar">http://foo.bar</a>.',
33 'http://foo.bar/foo.bar#foo.bar.' => '<a class="external" href="http://foo.bar/foo.bar#foo.bar">http://foo.bar/foo.bar#foo.bar</a>.',
34 'www.foo.bar' => '<a class="external" href="http://www.foo.bar">www.foo.bar</a>',
35 '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>',
36 'http://foo.bar/page#125' => '<a class="external" href="http://foo.bar/page#125">http://foo.bar/page#125</a>'
37 37 }
38 38 to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text) }
39 39 end
@@ -49,8 +49,9 class ApplicationHelperTest < HelperTestCase
49 49 '!http://foo.bar/image.jpg!' => '<img src="http://foo.bar/image.jpg" alt="" />',
50 50 'floating !>http://foo.bar/image.jpg!' => 'floating <div style="float:right"><img src="http://foo.bar/image.jpg" alt="" /></div>',
51 51 # textile links
52 'This is a "link":http://foo.bar' => 'This is a <a href="http://foo.bar">link</a>',
53 '"link (Link title)":http://foo.bar' => '<a href="http://foo.bar" title="Link title">link</a>'
52 'This is a "link":http://foo.bar' => 'This is a <a href="http://foo.bar" class="external">link</a>',
53 'This is an intern "link":/foo/bar' => 'This is an intern <a href="/foo/bar">link</a>',
54 '"link (Link title)":http://foo.bar' => '<a href="http://foo.bar" title="Link title" class="external">link</a>'
54 55 }
55 56 to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text) }
56 57 end
General Comments 0
You need to be logged in to leave comments. Login now