Project

General

Profile

Patch #18778 ยป new-alias-for-issue-link.diff

Katsuya HIDAKA, 2015-01-08 06:23

View differences:

app/helpers/application_helper.rb
729 729
  #     identifier:version:1.0.0
730 730
  #     identifier:source:some/file
731 731
  def parse_redmine_links(text, default_project, obj, attr, only_path, options)
732
    text.gsub!(%r{<a( [^>]+?)?>(.*?)</a>|([\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|
732
    text.gsub!(%r{<a( [^>]+?)?>(.*?)</a>|([\s\(,\-\[\>]|^)(!)?(([a-z0-9\-_]+):)?(attachment|document|version|forum|news|message|project|commit|source|export)?(((#)|((([a-z0-9\-_]+)\|)?(r)))((\d+)((#note|#comment)?-(\d+))?)|(:)([^"\s<>][^\s<>]*?|"[^"]+?"))(?=(?=[[:punct:]][^A-Za-z0-9_/])|,|\s|\]|<|$)}) do |m|
733 733
      tag_content, leading, esc, project_prefix, project_identifier, prefix, repo_prefix, repo_identifier, sep, identifier, comment_suffix, comment_id = $1, $3, $4, $5, $6, $7, $12, $13, $10 || $14 || $20, $16 || $21, $17, $19
734 734
      if tag_content
735 735
        $&
test/unit/helpers/application_helper_test.rb
262 262
                               :class => Issue.find(3).css_classes, :title => 'Error 281 when updating a recipe (New)')
263 263
    note_link2 = link_to('#3#note-14', {:controller => 'issues', :action => 'show', :id => 3, :anchor => 'note-14'},
264 264
                               :class => Issue.find(3).css_classes, :title => 'Error 281 when updating a recipe (New)')
265

  
265
    comment_link = link_to('#3#comment-14', {:controller => 'issues', :action => 'show', :id => 3, :anchor => 'note-14'},
266
                           :class => Issue.find(3).css_classes, :title => 'Error 281 when updating a recipe (New)')
266 267
    revision_link = link_to('r1', {:controller => 'repositories', :action => 'revision', :id => 'ecookbook', :rev => 1},
267 268
                                   :class => 'changeset', :title => 'My very first commit do not escaping #<>&')
268 269
    revision_link2 = link_to('r2', {:controller => 'repositories', :action => 'revision', :id => 'ecookbook', :rev => 2},
......
304 305
      # ticket notes
305 306
      '#3-14'                       => note_link,
306 307
      '#3#note-14'                  => note_link2,
308
      '#3#comment-14'               => comment_link,
307 309
      # should not ignore leading zero
308 310
      '#03'                         => '#03',
309 311
      # changesets
    (1-1/1)