diff options
author | Koosha Khajeh Moogahi <koosha.khajeh@gmail.com> | 2012-12-29 20:42:24 +0100 |
---|---|---|
committer | Frédéric Buclin <LpSolit@gmail.com> | 2012-12-29 20:42:24 +0100 |
commit | 71d8496298cecff542d4b16c5aeb6170ea5672bd (patch) | |
tree | 75f96aee3d6dc72e25188fcd3de26fad9d41fcdd /Bugzilla | |
parent | fe4e7df68ed3232a81714f6082a8555a53a4c298 (diff) | |
download | bugs-71d8496298cecff542d4b16c5aeb6170ea5672bd.tar bugs-71d8496298cecff542d4b16c5aeb6170ea5672bd.tar.gz bugs-71d8496298cecff542d4b16c5aeb6170ea5672bd.tar.bz2 bugs-71d8496298cecff542d4b16c5aeb6170ea5672bd.tar.xz bugs-71d8496298cecff542d4b16c5aeb6170ea5672bd.zip |
Bug 804343: Implement autolinkification for a list of comment ids
r/a=LpSolit
Diffstat (limited to 'Bugzilla')
-rw-r--r-- | Bugzilla/Template.pm | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/Bugzilla/Template.pm b/Bugzilla/Template.pm index a2fc81489..dc064d8bb 100644 --- a/Bugzilla/Template.pm +++ b/Bugzilla/Template.pm @@ -236,7 +236,8 @@ sub quoteUrls { # empty string my $bug_word = template_var('terms')->{bug}; my $bug_re = qr/\Q$bug_word\E\s*\#?\s*(\d+)/i; - my $comment_re = qr/comment\s*\#?\s*(\d+)/i; + my $comment_word = template_var('terms')->{comment}; + my $comment_re = qr/(?:\Q$comment_word\E|comment)\s*\#?\s*(\d+)/i; $text =~ s~\b($bug_re(?:\s*,?\s*$comment_re)?|$comment_re) ~ # We have several choices. $1 here is the link, and $2-4 are set # depending on which part matched @@ -261,6 +262,19 @@ sub quoteUrls { substr($text, $offset, $length) = $match; } + my $comments_word = template_var('terms')->{comments}; + + my $comments_re = qr/(?:comments|\Q$comments_word\E)\s*\#?\s* + \d+(?:\s*,\s*\#?\s*\d+)+/ix; + while ($text =~ m/($comments_re)/go) { + my $offset = $-[0]; + my $length = $+[0] - $-[0]; + my $match = $1; + + $match =~ s|((?:#\s*)?(\d+))|<a href="$current_bugurl#c$2">$1</a>|g; + substr($text, $offset, $length) = $match; + } + # Old duplicate markers. These don't use $bug_word because they are old # and were never customizable. $text =~ s~(?<=^\*\*\*\ This\ bug\ has\ been\ marked\ as\ a\ duplicate\ of\ ) |