Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
bugzilla
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
bugzilla
Commits
a4429897
Commit
a4429897
authored
7 years ago
by
Vitaly Lipatov
Committed by
System Administrator
5 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Template.pm: add bug/eterbug/# support
parent
44e9f335
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
4 deletions
+31
-4
Template.pm
Bugzilla/Template.pm
+31
-4
No files found.
Bugzilla/Template.pm
View file @
a4429897
...
...
@@ -243,9 +243,13 @@ sub quoteUrls {
# 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
my $bug_word = template_var('terms')->{bug};
# 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 = 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)
~ # We have several choices. $1 here is the link, and $2-4 are set
...
...
@@ -254,10 +258,12 @@ sub quoteUrls {
"
<
a
href
=\
"$current_bugurl#c$4\">$1</a>"
)
~
egx
;
# 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};
my
$bugs_word
=
'bugs'
;
my
$bugs_re
=
qr/\Q$bugs_word\E$s*\#?$s*
[0-9]+(?:$s*,$s*\#?$s*[0-9]+)+/
ix
;
...
...
@@ -268,7 +274,8 @@ sub quoteUrls {
$match;
}eg
;
my
$comments_word
=
template_var
(
'terms'
)
->
{
comments
};
#my $comments_word = template_var('terms')->{comments};
my
$comments_word
=
'comments'
;
my
$comments_re
=
qr/(?:comments|\Q$comments_word\E)$s*\#?$s*
[0-9]+(?:$s*,$s*\#?$s*[0-9]+)+/
ix
;
...
...
@@ -279,6 +286,26 @@ sub quoteUrls {
$match;
}eg
;
# make eterbug number link to bug
$bug_re
=
qr/eterbug\#?$s*([0-9]+)/
i
;
# hack: user prev comment_re
$text
=~
s
~
$bug_re
~
# We have several choices. $1 here is the link, and $2-4 are set
# depending on which part matched
get_bug_link
(
$1
,
$1
,
{
user
=>
$user
})
~
egx
;
# make # number link to bug
$bug_re
=
qr/[^&]\#$s*([0-9]+)/
i
;
#my $bug_ren = qr/\QTOG\E$s*\#?$s*([0-9]+)/i;
# hack: user prev comment_re
$text
=~
s
~
$bug_re
~
# We have several choices. $1 here is the link, and $2-4 are set
# depending on which part matched
get_bug_link
(
$1
,
$1
,
{
user
=>
$user
})
~
egx
;
# 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
\
)
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment