@@ -797,8 +797,20 module ApplicationHelper | |||
|
797 | 797 | # identifier:version:1.0.0 |
|
798 | 798 | # identifier:source:some/file |
|
799 | 799 | def parse_redmine_links(text, default_project, obj, attr, only_path, options) |
|
800 | 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| | |
|
801 | 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 | |
|
800 | text.gsub!(LINKS_RE) do |_| | |
|
801 | tag_content = $~[:tag_content] | |
|
802 | leading = $~[:leading] | |
|
803 | esc = $~[:esc] | |
|
804 | project_prefix = $~[:project_prefix] | |
|
805 | project_identifier = $~[:project_identifier] | |
|
806 | prefix = $~[:prefix] | |
|
807 | repo_prefix = $~[:repo_prefix] | |
|
808 | repo_identifier = $~[:repo_identifier] | |
|
809 | sep = $~[:sep1] || $~[:sep2] || $~[:sep3] | |
|
810 | identifier = $~[:identifier1] || $~[:identifier2] | |
|
811 | comment_suffix = $~[:comment_suffix] | |
|
812 | comment_id = $~[:comment_id] | |
|
813 | ||
|
802 | 814 | if tag_content |
|
803 | 815 | $& |
|
804 | 816 | else |
@@ -933,6 +945,39 module ApplicationHelper | |||
|
933 | 945 | end |
|
934 | 946 | end |
|
935 | 947 | |
|
948 | LINKS_RE = | |
|
949 | %r{ | |
|
950 | <a( [^>]+?)?>(?<tag_content>.*?)</a>| | |
|
951 | (?<leading>[\s\(,\-\[\>]|^) | |
|
952 | (?<esc>!)? | |
|
953 | (?<project_prefix>(?<project_identifier>[a-z0-9\-_]+):)? | |
|
954 | (?<prefix>attachment|document|version|forum|news|message|project|commit|source|export)? | |
|
955 | ( | |
|
956 | ( | |
|
957 | (?<sep1>\#)| | |
|
958 | ( | |
|
959 | (?<repo_prefix>(?<repo_identifier>[a-z0-9\-_]+)\|)? | |
|
960 | (?<sep2>r) | |
|
961 | ) | |
|
962 | ) | |
|
963 | ( | |
|
964 | (?<identifier1>\d+) | |
|
965 | (?<comment_suffix> | |
|
966 | (\#note)? | |
|
967 | -(?<comment_id>\d+) | |
|
968 | )? | |
|
969 | )| | |
|
970 | (?<sep3>:) | |
|
971 | (?<identifier2>[^"\s<>][^\s<>]*?|"[^"]+?") | |
|
972 | ) | |
|
973 | (?= | |
|
974 | (?=[[:punct:]][^A-Za-z0-9_/])| | |
|
975 | ,| | |
|
976 | \s| | |
|
977 | \]| | |
|
978 | <| | |
|
979 | $) | |
|
980 | }x | |
|
936 | 981 | HEADING_RE = /(<h(\d)( [^>]+)?>(.+?)<\/h(\d)>)/i unless const_defined?(:HEADING_RE) |
|
937 | 982 | |
|
938 | 983 | def parse_sections(text, project, obj, attr, only_path, options) |
General Comments 0
You need to be logged in to leave comments.
Login now