Commit 01baf132 authored by Vitaly Lipatov's avatar Vitaly Lipatov

fix Template.pm

parent 2a3493e9
......@@ -257,8 +257,13 @@ sub quoteUrls {
# Also, we can't use $bug_re?$comment_re? because that will match the
# empty string
my $bug_word = template_var('terms')->{bug};
# https://bugs.etersoft.ru/show_bug.cgi?id=6952#c141
# FIXME: what come from translation?
my $bug_word = 'bugs';
my $bug_re = qr/\Q$bug_word\E$s*\#?$s*([0-9]+)/i;
my $comment_word = template_var('terms')->{comment};
# FIXME: what come from translation?
my $comment_word = 'comment';
my $comment_re = qr/(?:\Q$comment_word\E|comment)$s*\#?$s*([0-9]+)/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
......@@ -267,27 +272,11 @@ sub quoteUrls {
"<a href=\"$current_bugurl#c$4\">$1</a>")
~egx;
# # Current bug ID this comment belongs to
# my $current_bugurl = $bug ? ("show_bug.cgi?id=" . $bug->id) : "";
#
# # This handles bug a, comment b type stuff. Because we're using /g
# # we have to do this in one pattern, and so this is semi-messy.
# # Also, we can't use $bug_re?$comment_re? because that will match the
# # empty string
#
# # https://bugs.etersoft.ru/show_bug.cgi?id=6952#c141
# #my $bug_word = template_var('terms')->{bug};
# my $bug_word = 'bug';
# my $bug_re = qr/\Q$bug_word\E$s*\#?$s*([0-9]+)/i;
# #my $comment_word = template_var('terms')->{comment};
# my $comment_word = 'comment';
# my $comment_re = qr/(?:\Q$comment_word\E|comment)$s*\#?$s*([0-9]+)/i;
# $text =~ s~\b($bug_re(?:$s*,?$s*$comment_re)?|$comment_re)
# Handle a list of bug ids: bugs 1, #2, 3, 4
# Currently, the only delimiter supported is comma.
# Concluding "and" and "or" are not supported.
#my $bugs_word = template_var('terms')->{bugs};
my $bugs_word = template_var('terms')->{bugs};
# FIXME: what come from translation?
my $bugs_word = 'bugs';
my $bugs_re = qr/\Q$bugs_word\E$s*\#?$s*
......@@ -299,7 +288,8 @@ sub quoteUrls {
$match;
}eg;
#my $comments_word = template_var('terms')->{comments};
my $comments_word = template_var('terms')->{comments};
# FIXME: what come from translation?
my $comments_word = 'comments';
my $comments_re = qr/(?:comments|\Q$comments_word\E)$s*\#?$s*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment