Commit ca268b85 authored by Robert Speicher's avatar Robert Speicher

Use to_reference in Markdown feature spec

parent 3b80cf52
...@@ -344,13 +344,13 @@ class MarkdownFeature ...@@ -344,13 +344,13 @@ class MarkdownFeature
end end
def commit def commit
@commit ||= project.repository.commit @commit ||= project.commit
end end
def commit_range def commit_range
unless @commit_range unless @commit_range
commit2 = project.repository.commit('HEAD~3') commit2 = project.commit('HEAD~3')
@commit_range = CommitRange.new("#{commit.id}...#{commit2.id}") @commit_range = CommitRange.new("#{commit.id}...#{commit2.id}", project)
end end
@commit_range @commit_range
...@@ -376,11 +376,6 @@ class MarkdownFeature ...@@ -376,11 +376,6 @@ class MarkdownFeature
@xproject @xproject
end end
# Shortcut to "cross-reference/project"
def xref
xproject.path_with_namespace
end
def xissue def xissue
@xissue ||= create(:issue, project: xproject) @xissue ||= create(:issue, project: xproject)
end end
...@@ -394,13 +389,13 @@ class MarkdownFeature ...@@ -394,13 +389,13 @@ class MarkdownFeature
end end
def xcommit def xcommit
@xcommit ||= xproject.repository.commit @xcommit ||= xproject.commit
end end
def xcommit_range def xcommit_range
unless @xcommit_range unless @xcommit_range
xcommit2 = xproject.repository.commit('HEAD~2') xcommit2 = xproject.commit('HEAD~2')
@xcommit_range = CommitRange.new("#{xcommit.id}...#{xcommit2.id}") @xcommit_range = CommitRange.new("#{xcommit.id}...#{xcommit2.id}", xproject)
end end
@xcommit_range @xcommit_range
......
...@@ -127,61 +127,61 @@ But it shouldn't autolink text inside certain tags: ...@@ -127,61 +127,61 @@ But it shouldn't autolink text inside certain tags:
- <a>http://about.gitlab.com/</a> - <a>http://about.gitlab.com/</a>
- <kbd>http://about.gitlab.com/</kbd> - <kbd>http://about.gitlab.com/</kbd>
### Reference Filters (e.g., #<%= issue.iid %>) ### Reference Filters (e.g., <%= issue.to_reference %>)
References should be parseable even inside _!<%= merge_request.iid %>_ emphasis. References should be parseable even inside _<%= merge_request.to_reference %>_ emphasis.
#### UserReferenceFilter #### UserReferenceFilter
- All: @all - All: @all
- User: @<%= user.username %> - User: <%= user.to_reference %>
- Group: @<%= group.name %> - Group: <%= group.to_reference %>
- Ignores invalid: @fake_user - Ignores invalid: <%= User.reference_prefix %>fake_user
- Ignored in code: `@<%= user.username %>` - Ignored in code: `<%= user.to_reference %>`
- Ignored in links: [Link to @<%= user.username %>](#user-link) - Ignored in links: [Link to <%= user.to_reference %>](#user-link)
#### IssueReferenceFilter #### IssueReferenceFilter
- Issue: #<%= issue.iid %> - Issue: <%= issue.to_reference %>
- Issue in another project: <%= xref %>#<%= xissue.iid %> - Issue in another project: <%= xissue.to_reference(project) %>
- Ignored in code: `#<%= issue.iid %>` - Ignored in code: `<%= issue.to_reference %>`
- Ignored in links: [Link to #<%= issue.iid %>](#issue-link) - Ignored in links: [Link to <%= issue.to_reference %>](#issue-link)
#### MergeRequestReferenceFilter #### MergeRequestReferenceFilter
- Merge request: !<%= merge_request.iid %> - Merge request: <%= merge_request.to_reference %>
- Merge request in another project: <%= xref %>!<%= xmerge_request.iid %> - Merge request in another project: <%= xmerge_request.to_reference(project) %>
- Ignored in code: `!<%= merge_request.iid %>` - Ignored in code: `<%= merge_request.to_reference %>`
- Ignored in links: [Link to !<%= merge_request.iid %>](#merge-request-link) - Ignored in links: [Link to <%= merge_request.to_reference %>](#merge-request-link)
#### SnippetReferenceFilter #### SnippetReferenceFilter
- Snippet: $<%= snippet.id %> - Snippet: <%= snippet.to_reference %>
- Snippet in another project: <%= xref %>$<%= xsnippet.id %> - Snippet in another project: <%= xsnippet.to_reference(project) %>
- Ignored in code: `$<%= snippet.id %>` - Ignored in code: `<%= snippet.to_reference %>`
- Ignored in links: [Link to $<%= snippet.id %>](#snippet-link) - Ignored in links: [Link to <%= snippet.to_reference %>](#snippet-link)
#### CommitRangeReferenceFilter #### CommitRangeReferenceFilter
- Range: <%= commit_range %> - Range: <%= commit_range.to_reference %>
- Range in another project: <%= xref %>@<%= xcommit_range %> - Range in another project: <%= xcommit_range.to_reference(project) %>
- Ignored in code: `<%= commit_range %>` - Ignored in code: `<%= commit_range.to_reference %>`
- Ignored in links: [Link to <%= commit_range %>](#commit-range-link) - Ignored in links: [Link to <%= commit_range.to_reference %>](#commit-range-link)
#### CommitReferenceFilter #### CommitReferenceFilter
- Commit: <%= commit.id %> - Commit: <%= commit.to_reference %>
- Commit in another project: <%= xref %>@<%= xcommit.id %> - Commit in another project: <%= xcommit.to_reference(project) %>
- Ignored in code: `<%= commit.id %>` - Ignored in code: `<%= commit.to_reference %>`
- Ignored in links: [Link to <%= commit.id %>](#commit-link) - Ignored in links: [Link to <%= commit.to_reference %>](#commit-link)
#### LabelReferenceFilter #### LabelReferenceFilter
- Label by ID: ~<%= simple_label.id %> - Label by ID: <%= simple_label.to_reference %>
- Label by name: ~<%= simple_label.name %> - Label by name: <%= Label.reference_prefix %><%= simple_label.name %>
- Label by name in quotes: ~"<%= label.name %>" - Label by name in quotes: <%= label.to_reference(:name) %>
- Ignored in code: `~<%= simple_label.name %>` - Ignored in code: `<%= simple_label.to_reference %>`
- Ignored in links: [Link to ~<%= simple_label.id %>](#label-link) - Ignored in links: [Link to <%= simple_label.to_reference %>](#label-link)
### Task Lists ### Task Lists
......
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