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