##// END OF EJS Templates
Redmine links regexp fix (#1369, url hash turned into a ticket link)....
Jean-Philippe Lang -
r1478:cd824c6ecf38
parent child
Show More
@@ -298,7 +298,7 module ApplicationHelper
298 # source:some/file#L120 -> Link to line 120 of the file
298 # source:some/file#L120 -> Link to line 120 of the file
299 # source:some/file@52#L120 -> Link to line 120 of the file's revision 52
299 # source:some/file@52#L120 -> Link to line 120 of the file's revision 52
300 # export:some/file -> Force the download of the file
300 # export:some/file -> Force the download of the file
301 text = text.gsub(%r{([\s\(,-^])(!)?(attachment|document|version|commit|source|export)?((#|r)(\d+)|(:)([^"\s<>][^\s<>]*|"[^"]+"))(?=[[:punct:]]|\s|<|$)}) do |m|
301 text = text.gsub(%r{([\s\(,\-\>]|^)(!)?(attachment|document|version|commit|source|export)?((#|r)(\d+)|(:)([^"\s<>][^\s<>]*|"[^"]+"))(?=[[:punct:]]|\s|<|$)}) do |m|
302 leading, esc, prefix, sep, oid = $1, $2, $3, $5 || $7, $6 || $8
302 leading, esc, prefix, sep, oid = $1, $2, $3, $5 || $7, $6 || $8
303 link = nil
303 link = nil
304 if esc.nil?
304 if esc.nil?
@@ -108,7 +108,9 class ApplicationHelperTest < HelperTestCase
108 '!version:"1.0"' => 'version:"1.0"',
108 '!version:"1.0"' => 'version:"1.0"',
109 '!source:/some/file' => 'source:/some/file',
109 '!source:/some/file' => 'source:/some/file',
110 # invalid expressions
110 # invalid expressions
111 'source:' => 'source:'
111 'source:' => 'source:',
112 # url hash
113 "http://foo.bar/FAQ#3" => '<a class="external" href="http://foo.bar/FAQ#3">http://foo.bar/FAQ#3</a>',
112 }
114 }
113 @project = Project.find(1)
115 @project = Project.find(1)
114 to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text) }
116 to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text) }
General Comments 0
You need to be logged in to leave comments. Login now