Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
m0_70890014
gitlabhq
提交
539b4192
G
gitlabhq
项目概览
m0_70890014
/
gitlabhq
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlabhq
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
539b4192
编写于
1月 07, 2016
作者:
D
Douwe Maan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Milestone reference is a Markdown link
上级
b38eabda
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
8 addition
and
3 deletion
+8
-3
app/models/milestone.rb
app/models/milestone.rb
+5
-1
spec/fixtures/markdown.md.erb
spec/fixtures/markdown.md.erb
+0
-1
spec/lib/banzai/filter/milestone_reference_filter_spec.rb
spec/lib/banzai/filter/milestone_reference_filter_spec.rb
+3
-1
未找到文件。
app/models/milestone.rb
浏览文件 @
539b4192
...
...
@@ -71,8 +71,12 @@ class Milestone < ActiveRecord::Base
end
def
to_reference
(
from_project
=
nil
)
escaped_title
=
self
.
title
.
gsub
(
"]"
,
"
\\
]"
)
h
=
Gitlab
::
Application
.
routes
.
url_helpers
h
.
namespace_project_milestone_url
(
self
.
project
.
namespace
,
self
.
project
,
self
)
url
=
h
.
namespace_project_milestone_url
(
self
.
project
.
namespace
,
self
.
project
,
self
)
"[
#{
escaped_title
}
](
#{
url
}
)"
end
def
reference_link_text
(
from_project
=
nil
)
...
...
spec/fixtures/markdown.md.erb
浏览文件 @
539b4192
...
...
@@ -219,7 +219,6 @@ References should be parseable even inside _<%= merge_request.to_reference %>_ e
- Milestone:
<%=
milestone
.
to_reference
%>
- Milestone in another project:
<%=
xmilestone
.
to_reference
(
project
)
%>
- Ignored in code: `
<%=
milestone
.
to_reference
%>
`
- Ignored in links: [Link to
<%=
milestone
.
to_reference
%>
](#milestone-link)
- Link to milestone by URL: [Milestone](
<%=
urls
.
namespace_project_milestone_url
(
milestone
.
project
.
namespace
,
milestone
.
project
,
milestone
)
%>
)
### Task Lists
...
...
spec/lib/banzai/filter/milestone_reference_filter_spec.rb
浏览文件 @
539b4192
...
...
@@ -18,7 +18,9 @@ describe Banzai::Filter::MilestoneReferenceFilter, lib: true do
end
context
'internal reference'
do
let
(
:reference
)
{
milestone
.
to_reference
}
# Convert the Markdown link to only the URL, since these tests aren't run through the regular Markdown pipeline.
# Milestone reference behavior in the full Markdown pipeline is tested elsewhere.
let
(
:reference
)
{
milestone
.
to_reference
.
gsub
(
/\[([^\]]+)\]\(([^)]+)\)/
,
'\2'
)
}
it
'links to a valid reference'
do
doc
=
reference_filter
(
"See
#{
reference
}
"
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录