Commit 6d9794d4 authored by Alejandro Rodríguez's avatar Alejandro Rodríguez

Transforming milestones link references to the short reference form

parent 375e83bb
...@@ -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])
......
...@@ -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
......
...@@ -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
......
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