Index: app/helpers/application_helper.rb IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- app/helpers/application_helper.rb (revision b85dc8b35c93af0a0cbcca156c479f20e25af186) +++ app/helpers/application_helper.rb (revision ) @@ -768,8 +768,20 @@ # identifier:version:1.0.0 # identifier:source:some/file def parse_redmine_links(text, default_project, obj, attr, only_path, options) - 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| - tag_content, leading, esc, project_prefix, project_identifier, prefix, repo_prefix, repo_identifier, sep, identifier, comment_suffix, comment_id = $2, $3, $4, $5, $6, $7, $12, $13, $10 || $14 || $20, $16 || $21, $17, $19 + text.gsub!(LINKS_RE) do |_| + tag_content = $~[:tag_content] + leading = $~[:leading] + esc = $~[:esc] + project_prefix = $~[:project_prefix] + project_identifier = $~[:project_identifier] + prefix = $~[:prefix] + repo_prefix = $~[:repo_prefix] + repo_identifier = $~[:repo_identifier] + sep = $~[:sep1] || $~[:sep2] || $~[:sep3] + identifier = $~[:identifier1] || $~[:identifier2] + comment_suffix = $~[:comment_suffix] + comment_id = $~[:comment_id] + if tag_content $& else @@ -904,6 +916,39 @@ end end + LINKS_RE = + %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| + \]| + <| + $) + }x HEADING_RE = /(]+)?>(.+?)<\/h(\d)>)/i unless const_defined?(:HEADING_RE) def parse_sections(text, project, obj, attr, only_path, options)