提交 77c53f61 编写于 作者: R Reuben Pereira

Remove the restriction preventing project references with text adjacent to the > character

上级 d6f4810e
......@@ -465,14 +465,12 @@ class Project < ActiveRecord::Base
end
# Pattern used to extract `namespace/project>` project references from text.
# (?!\w) matches any non-word character.
# '>' or its escaped form ('&gt;') are checked for because '>' is sometimes escaped
# when the reference comes from an external source.
def markdown_reference_pattern
%r{
#{reference_pattern}
(#{reference_postfix}|#{reference_postfix_escaped})
(?!\w)
}x
end
......
......@@ -24,9 +24,9 @@ describe Banzai::Filter::ProjectReferenceFilter do
expect(reference_filter(act).to_html).to eq(CGI.escapeHTML(exp))
end
it 'ignores references with text after the > sign' do
exp = act = "Hey #{reference}foo"
expect(reference_filter(act).to_html).to eq CGI.escapeHTML(exp)
it 'allows references with text after the > character' do
doc = reference_filter("Hey #{reference}foo")
expect(doc.css('a').first.attr('href')).to eq urls.project_url(subject)
end
%w(pre code a style).each do |elem|
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册