Remove the restriction preventing project references with text adjacent to the > character
This commit is contained in:
parent
d6f4810ea1
commit
77c53f6126
2 changed files with 3 additions and 5 deletions
|
@ -465,14 +465,12 @@ class Project < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
# Pattern used to extract `namespace/project>` project references from text.
|
# Pattern used to extract `namespace/project>` project references from text.
|
||||||
# (?!\w) matches any non-word character.
|
|
||||||
# '>' or its escaped form ('>') are checked for because '>' is sometimes escaped
|
# '>' or its escaped form ('>') are checked for because '>' is sometimes escaped
|
||||||
# when the reference comes from an external source.
|
# when the reference comes from an external source.
|
||||||
def markdown_reference_pattern
|
def markdown_reference_pattern
|
||||||
%r{
|
%r{
|
||||||
#{reference_pattern}
|
#{reference_pattern}
|
||||||
(#{reference_postfix}|#{reference_postfix_escaped})
|
(#{reference_postfix}|#{reference_postfix_escaped})
|
||||||
(?!\w)
|
|
||||||
}x
|
}x
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -24,9 +24,9 @@ describe Banzai::Filter::ProjectReferenceFilter do
|
||||||
expect(reference_filter(act).to_html).to eq(CGI.escapeHTML(exp))
|
expect(reference_filter(act).to_html).to eq(CGI.escapeHTML(exp))
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'ignores references with text after the > sign' do
|
it 'allows references with text after the > character' do
|
||||||
exp = act = "Hey #{reference}foo"
|
doc = reference_filter("Hey #{reference}foo")
|
||||||
expect(reference_filter(act).to_html).to eq CGI.escapeHTML(exp)
|
expect(doc.css('a').first.attr('href')).to eq urls.project_url(subject)
|
||||||
end
|
end
|
||||||
|
|
||||||
%w(pre code a style).each do |elem|
|
%w(pre code a style).each do |elem|
|
||||||
|
|
Loading…
Reference in a new issue