Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
96f8ad06
Commit
96f8ad06
authored
Jun 18, 2018
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Properly detect label reference if followed by period or question mark
parent
99fdbe4c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
7 deletions
+17
-7
app/models/label.rb
app/models/label.rb
+10
-5
changelogs/unreleased/dm-label-reference-period.yml
changelogs/unreleased/dm-label-reference-period.yml
+5
-0
spec/lib/banzai/filter/label_reference_filter_spec.rb
spec/lib/banzai/filter/label_reference_filter_spec.rb
+2
-2
No files found.
app/models/label.rb
View file @
96f8ad06
...
...
@@ -85,11 +85,16 @@ class Label < ActiveRecord::Base
(
#{
Project
.
reference_pattern
}
)?
#{
Regexp
.
escape
(
reference_prefix
)
}
(?:
(?<label_id>
\d
+(?!
\S\w
)
\b
) | # Integer-based label ID, or
(?<label_name>
[A-Za-z0-9_
\-\?\.
&]+ | # String-based single-word label title, or
".+?" # String-based multi-word label surrounded in quotes
)
(?<label_id>
\d
+(?!
\S\w
)
\b
)
| # Integer-based label ID, or
(?<label_name>
# String-based single-word label title, or
[A-Za-z0-9_
\-\?\.
&]+
(?<!
\.
|
\?
)
|
# String-based multi-word label surrounded in quotes
".+?"
)
)
}x
end
...
...
changelogs/unreleased/dm-label-reference-period.yml
0 → 100644
View file @
96f8ad06
---
title
:
Properly detect label reference if followed by period or question mark
merge_request
:
author
:
type
:
fixed
spec/lib/banzai/filter/label_reference_filter_spec.rb
View file @
96f8ad06
...
...
@@ -149,8 +149,8 @@ describe Banzai::Filter::LabelReferenceFilter do
end
it
'links with adjacent text'
do
doc
=
reference_filter
(
"Label
(
#{
reference
}
)
."
)
expect
(
doc
.
to_html
).
to
match
(
%r(
\(
<a.+><span.+>
\?
g
\.
fm&</span></a>
\)
\.
)
)
doc
=
reference_filter
(
"Label
#{
reference
}
."
)
expect
(
doc
.
to_html
).
to
match
(
%r(
<a.+><span.+>
\?
g
\.
fm&</span></a>
\.
)
)
end
it
'ignores invalid label names'
do
...
...
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