##// END OF EJS Templates
Fixed: trailing period should not be included in redmine links of type class:id (#1612)....
Jean-Philippe Lang -
r1636:d7eb689c7454
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:]]\W)|\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?
@@ -82,6 +82,7 class ApplicationHelperTest < HelperTestCase
82 :class => 'version')
82 :class => 'version')
83
83
84 source_url = {:controller => 'repositories', :action => 'entry', :id => 'ecookbook', :path => ['some', 'file']}
84 source_url = {:controller => 'repositories', :action => 'entry', :id => 'ecookbook', :path => ['some', 'file']}
85 source_url_with_ext = {:controller => 'repositories', :action => 'entry', :id => 'ecookbook', :path => ['some', 'file.ext']}
85
86
86 to_test = {
87 to_test = {
87 # tickets
88 # tickets
@@ -97,8 +98,15 class ApplicationHelperTest < HelperTestCase
97 'version:"1.0"' => version_link,
98 'version:"1.0"' => version_link,
98 # source
99 # source
99 'source:/some/file' => link_to('source:/some/file', source_url, :class => 'source'),
100 'source:/some/file' => link_to('source:/some/file', source_url, :class => 'source'),
101 'source:/some/file.' => link_to('source:/some/file', source_url, :class => 'source') + ".",
102 'source:/some/file.ext.' => link_to('source:/some/file.ext', source_url_with_ext, :class => 'source') + ".",
103 'source:/some/file. ' => link_to('source:/some/file', source_url, :class => 'source') + ".",
104 'source:/some/file.ext. ' => link_to('source:/some/file.ext', source_url_with_ext, :class => 'source') + ".",
105 'source:/some/file, ' => link_to('source:/some/file', source_url, :class => 'source') + ",",
100 'source:/some/file@52' => link_to('source:/some/file@52', source_url.merge(:rev => 52), :class => 'source'),
106 'source:/some/file@52' => link_to('source:/some/file@52', source_url.merge(:rev => 52), :class => 'source'),
107 'source:/some/file.ext@52' => link_to('source:/some/file.ext@52', source_url_with_ext.merge(:rev => 52), :class => 'source'),
101 'source:/some/file#L110' => link_to('source:/some/file#L110', source_url.merge(:anchor => 'L110'), :class => 'source'),
108 'source:/some/file#L110' => link_to('source:/some/file#L110', source_url.merge(:anchor => 'L110'), :class => 'source'),
109 'source:/some/file.ext#L110' => link_to('source:/some/file.ext#L110', source_url_with_ext.merge(:anchor => 'L110'), :class => 'source'),
102 'source:/some/file@52#L110' => link_to('source:/some/file@52#L110', source_url.merge(:rev => 52, :anchor => 'L110'), :class => 'source'),
110 'source:/some/file@52#L110' => link_to('source:/some/file@52#L110', source_url.merge(:rev => 52, :anchor => 'L110'), :class => 'source'),
103 'export:/some/file' => link_to('export:/some/file', source_url.merge(:format => 'raw'), :class => 'source download'),
111 'export:/some/file' => link_to('export:/some/file', source_url.merge(:format => 'raw'), :class => 'source download'),
104 # escaping
112 # escaping
General Comments 0
You need to be logged in to leave comments. Login now