@@ -511,17 +511,17 module ApplicationHelper | |||||
511 | # Forum messages: |
|
511 | # Forum messages: | |
512 | # message#1218 -> Link to message with id 1218 |
|
512 | # message#1218 -> Link to message with id 1218 | |
513 | text = text.gsub(%r{([\s\(,\-\>]|^)(!)?(attachment|document|version|commit|source|export|message|project)?((#|r)(\d+)|(:)([^"\s<>][^\s<>]*?|"[^"]+?"))(?=(?=[[:punct:]]\W)|,|\s|<|$)}) do |m| |
|
513 | text = text.gsub(%r{([\s\(,\-\>]|^)(!)?(attachment|document|version|commit|source|export|message|project)?((#|r)(\d+)|(:)([^"\s<>][^\s<>]*?|"[^"]+?"))(?=(?=[[:punct:]]\W)|,|\s|<|$)}) do |m| | |
514 |
leading, esc, prefix, sep, |
|
514 | leading, esc, prefix, sep, identifier = $1, $2, $3, $5 || $7, $6 || $8 | |
515 | link = nil |
|
515 | link = nil | |
516 | if esc.nil? |
|
516 | if esc.nil? | |
517 | if prefix.nil? && sep == 'r' |
|
517 | if prefix.nil? && sep == 'r' | |
518 |
if project && (changeset = project.changesets.find_by_revision( |
|
518 | if project && (changeset = project.changesets.find_by_revision(identifier)) | |
519 |
link = link_to("r#{ |
|
519 | link = link_to("r#{identifier}", {:only_path => only_path, :controller => 'repositories', :action => 'revision', :id => project, :rev => changeset.revision}, | |
520 | :class => 'changeset', |
|
520 | :class => 'changeset', | |
521 | :title => truncate_single_line(changeset.comments, :length => 100)) |
|
521 | :title => truncate_single_line(changeset.comments, :length => 100)) | |
522 | end |
|
522 | end | |
523 | elsif sep == '#' |
|
523 | elsif sep == '#' | |
524 |
oid = |
|
524 | oid = identifier.to_i | |
525 | case prefix |
|
525 | case prefix | |
526 | when nil |
|
526 | when nil | |
527 | if issue = Issue.visible.find_by_id(oid, :include => :status) |
|
527 | if issue = Issue.visible.find_by_id(oid, :include => :status) | |
@@ -557,7 +557,7 module ApplicationHelper | |||||
557 | end |
|
557 | end | |
558 | elsif sep == ':' |
|
558 | elsif sep == ':' | |
559 | # removes the double quotes if any |
|
559 | # removes the double quotes if any | |
560 |
name = |
|
560 | name = identifier.gsub(%r{^"(.*)"$}, "\\1") | |
561 | case prefix |
|
561 | case prefix | |
562 | when 'document' |
|
562 | when 'document' | |
563 | if project && document = project.documents.find_by_title(name) |
|
563 | if project && document = project.documents.find_by_title(name) | |
@@ -599,7 +599,7 module ApplicationHelper | |||||
599 | end |
|
599 | end | |
600 | end |
|
600 | end | |
601 | end |
|
601 | end | |
602 |
leading + (link || "#{prefix}#{sep}#{ |
|
602 | leading + (link || "#{prefix}#{sep}#{identifier}") | |
603 | end |
|
603 | end | |
604 |
|
604 | |||
605 | text |
|
605 | text |
@@ -200,6 +200,8 RAW | |||||
200 | '!version:1.0' => 'version:1.0', |
|
200 | '!version:1.0' => 'version:1.0', | |
201 | '!version:"1.0"' => 'version:"1.0"', |
|
201 | '!version:"1.0"' => 'version:"1.0"', | |
202 | '!source:/some/file' => 'source:/some/file', |
|
202 | '!source:/some/file' => 'source:/some/file', | |
|
203 | # not found | |||
|
204 | '#0123456789' => '#0123456789', | |||
203 | # invalid expressions |
|
205 | # invalid expressions | |
204 | 'source:' => 'source:', |
|
206 | 'source:' => 'source:', | |
205 | # url hash |
|
207 | # url hash |
General Comments 0
You need to be logged in to leave comments.
Login now