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
Boxiang Sun
gitlab-ce
Commits
6d9794d4
Commit
6d9794d4
authored
Apr 04, 2016
by
Alejandro Rodríguez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Transforming milestones link references to the short reference form
parent
375e83bb
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
1 deletion
+7
-1
lib/banzai/filter/milestone_reference_filter.rb
lib/banzai/filter/milestone_reference_filter.rb
+5
-0
spec/fixtures/markdown.md.erb
spec/fixtures/markdown.md.erb
+1
-0
spec/support/matchers/markdown_matchers.rb
spec/support/matchers/markdown_matchers.rb
+1
-1
No files found.
lib/banzai/filter/milestone_reference_filter.rb
View file @
6d9794d4
...
@@ -11,6 +11,11 @@ module Banzai
...
@@ -11,6 +11,11 @@ module Banzai
end
end
def
references_in
(
text
,
pattern
=
Milestone
.
reference_pattern
)
def
references_in
(
text
,
pattern
=
Milestone
.
reference_pattern
)
# We'll handle here the references that follow the `reference_pattern`.
# Other patterns (for example, the link pattern) are handled by the
# default implementation.
return
super
(
text
,
pattern
)
if
pattern
!=
Milestone
.
reference_pattern
text
.
gsub
(
pattern
)
do
|
match
|
text
.
gsub
(
pattern
)
do
|
match
|
project
=
project_from_ref
(
$~
[
:project
])
project
=
project_from_ref
(
$~
[
:project
])
params
=
milestone_params
(
$~
[
:milestone_iid
].
to_i
,
$~
[
:milestone_name
])
params
=
milestone_params
(
$~
[
:milestone_iid
].
to_i
,
$~
[
:milestone_name
])
...
...
spec/fixtures/markdown.md.erb
View file @
6d9794d4
...
@@ -222,6 +222,7 @@ References should be parseable even inside _<%= merge_request.to_reference %>_ e
...
@@ -222,6 +222,7 @@ References should be parseable even inside _<%= merge_request.to_reference %>_ e
- Milestone in another project:
<%=
xmilestone
.
to_reference
(
project
)
%>
- Milestone in another project:
<%=
xmilestone
.
to_reference
(
project
)
%>
- Ignored in code: `
<%=
simple_milestone
.
to_reference
%>
`
- Ignored in code: `
<%=
simple_milestone
.
to_reference
%>
`
- Ignored in links: [Link to
<%=
simple_milestone
.
to_reference
%>
](#milestone-link)
- Ignored in links: [Link to
<%=
simple_milestone
.
to_reference
%>
](#milestone-link)
- Milestone by URL:
<%=
urls
.
namespace_project_milestone_url
(
milestone
.
project
.
namespace
,
milestone
.
project
,
milestone
)
%>
- Link to milestone by URL: [Milestone](
<%=
milestone
.
to_reference
%>
)
- Link to milestone by URL: [Milestone](
<%=
milestone
.
to_reference
%>
)
### Task Lists
### Task Lists
...
...
spec/support/matchers/markdown_matchers.rb
View file @
6d9794d4
...
@@ -154,7 +154,7 @@ module MarkdownMatchers
...
@@ -154,7 +154,7 @@ module MarkdownMatchers
set_default_markdown_messages
set_default_markdown_messages
match
do
|
actual
|
match
do
|
actual
|
expect
(
actual
).
to
have_selector
(
'a.gfm.gfm-milestone'
,
count:
5
)
expect
(
actual
).
to
have_selector
(
'a.gfm.gfm-milestone'
,
count:
6
)
end
end
end
end
...
...
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