@@ -659,8 +659,8 module ApplicationHelper | |||
|
659 | 659 | # identifier:version:1.0.0 |
|
660 | 660 | # identifier:source:some/file |
|
661 | 661 | def parse_redmine_links(text, project, obj, attr, only_path, options) |
|
662 | text.gsub!(%r{([\s\(,\-\[\>]|^)(!)?(([a-z0-9\-_]+):)?(attachment|document|version|forum|news|message|project|commit|source|export)?(((#)|((([a-z0-9\-]+)\|)?(r)))(\d+)|(:)([^"\s<>][^\s<>]*?|"[^"]+?"))(?=(?=[[:punct:]][^A-Za-z0-9_/])|,|\s|\]|<|$)}) do |m| | |
|
663 |
leading, esc, project_prefix, project_identifier, prefix, repo_prefix, repo_identifier, sep, identifier = $1, $2, $3, $4, $5, $10, $11, $8 || $12 || $1 |
|
|
662 | text.gsub!(%r{([\s\(,\-\[\>]|^)(!)?(([a-z0-9\-_]+):)?(attachment|document|version|forum|news|message|project|commit|source|export)?(((#)|((([a-z0-9\-]+)\|)?(r)))((\d+)((#note)?-(\d+))?)|(:)([^"\s<>][^\s<>]*?|"[^"]+?"))(?=(?=[[:punct:]][^A-Za-z0-9_/])|,|\s|\]|<|$)}) do |m| | |
|
663 | leading, esc, project_prefix, project_identifier, prefix, repo_prefix, repo_identifier, sep, identifier, comment_suffix, comment_id = $1, $2, $3, $4, $5, $10, $11, $8 || $12 || $18, $14 || $19, $15, $17 | |
|
664 | 664 | link = nil |
|
665 | 665 | if project_identifier |
|
666 | 666 | project = Project.visible.find_by_identifier(project_identifier) |
@@ -686,7 +686,8 module ApplicationHelper | |||
|
686 | 686 | case prefix |
|
687 | 687 | when nil |
|
688 | 688 | if issue = Issue.visible.find_by_id(oid, :include => :status) |
|
689 | link = link_to("##{oid}", {:only_path => only_path, :controller => 'issues', :action => 'show', :id => oid}, | |
|
689 | anchor = comment_id ? "note-#{comment_id}" : nil | |
|
690 | link = link_to("##{oid}", {:only_path => only_path, :controller => 'issues', :action => 'show', :id => oid, :anchor => anchor}, | |
|
690 | 691 | :class => issue.css_classes, |
|
691 | 692 | :title => "#{truncate(issue.subject, :length => 100)} (#{issue.status.name})") |
|
692 | 693 | end |
@@ -785,7 +786,7 module ApplicationHelper | |||
|
785 | 786 | end |
|
786 | 787 | end |
|
787 | 788 | end |
|
788 | (leading + (link || "#{project_prefix}#{prefix}#{repo_prefix}#{sep}#{identifier}")).html_safe | |
|
789 | (leading + (link || "#{project_prefix}#{prefix}#{repo_prefix}#{sep}#{identifier}#{comment_suffix}")).html_safe | |
|
789 | 790 | end |
|
790 | 791 | end |
|
791 | 792 |
@@ -227,6 +227,8 RAW | |||
|
227 | 227 | def test_redmine_links |
|
228 | 228 | issue_link = link_to('#3', {:controller => 'issues', :action => 'show', :id => 3}, |
|
229 | 229 | :class => 'issue status-1 priority-1 overdue', :title => 'Error 281 when updating a recipe (New)') |
|
230 | note_link = link_to('#3', {:controller => 'issues', :action => 'show', :id => 3, :anchor => 'note-14'}, | |
|
231 | :class => 'issue status-1 priority-1 overdue', :title => 'Error 281 when updating a recipe (New)') | |
|
230 | 232 | |
|
231 | 233 | changeset_link = link_to('r1', {:controller => 'repositories', :action => 'revision', :id => 'ecookbook', :rev => 1}, |
|
232 | 234 | :class => 'changeset', :title => 'My very first commit') |
@@ -253,6 +255,9 RAW | |||
|
253 | 255 | to_test = { |
|
254 | 256 | # tickets |
|
255 | 257 | '#3, [#3], (#3) and #3.' => "#{issue_link}, [#{issue_link}], (#{issue_link}) and #{issue_link}.", |
|
258 | # ticket notes | |
|
259 | '#3-14' => note_link, | |
|
260 | '#3#note-14' => note_link, | |
|
256 | 261 | # changesets |
|
257 | 262 | 'r1' => changeset_link, |
|
258 | 263 | 'r1.' => "#{changeset_link}.", |
@@ -294,6 +299,8 RAW | |||
|
294 | 299 | 'project:"eCookbook subProject 1"' => link_to('eCookbook Subproject 1', project_url, :class => 'project'), |
|
295 | 300 | # escaping |
|
296 | 301 | '!#3.' => '#3.', |
|
302 | '!#3-14.' => '#3-14.', | |
|
303 | '!#3#-note14.' => '#3#-note14.', | |
|
297 | 304 | '!r1' => 'r1', |
|
298 | 305 | '!document#1' => 'document#1', |
|
299 | 306 | '!document:"Test document"' => 'document:"Test document"', |
General Comments 0
You need to be logged in to leave comments.
Login now