Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
heptapod
heptapod
Commits
f7f58494b433
Commit
6d9794d4
authored
Apr 04, 2016
by
Alejandro Rodríguez
Browse files
Transforming milestones link references to the short reference form
parent
8d82abe1df35
Changes
3
Hide whitespace changes
Inline
Side-by-side
lib/banzai/filter/milestone_reference_filter.rb
View file @
f7f58494
...
...
@@ -11,6 +11,11 @@ def find_object(project, id)
end
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
|
project
=
project_from_ref
(
$~
[
:project
])
params
=
milestone_params
(
$~
[
:milestone_iid
].
to_i
,
$~
[
:milestone_name
])
...
...
spec/fixtures/markdown.md.erb
View file @
f7f58494
...
...
@@ -222,6 +222,7 @@ References should be parseable even inside _<%= merge_request.to_reference %>_ e
- Milestone in another project:
<%=
xmilestone
.
to_reference
(
project
)
%>
- Ignored in code: `
<%=
simple_milestone
.
to_reference
%>
`
- 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
%>
)
### Task Lists
...
...
spec/support/matchers/markdown_matchers.rb
View file @
f7f58494
...
...
@@ -154,7 +154,7 @@ def have_image(src)
set_default_markdown_messages
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
...
...
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