Commit 94919c7e authored by Douwe Maan's avatar Douwe Maan

Ignore references in blockquotes.

parent fe78984f
......@@ -25,12 +25,18 @@ module Gitlab
ERB::Util.html_escape_once(html)
end
# Don't look for references in text nodes that are children of these
# elements.
IGNORE_PARENTS = %w(pre code a style).to_set
def ignore_parents
@ignore_parents ||= begin
# Don't look for references in text nodes that are children of these
# elements.
parents = %w(pre code a style)
parents << 'blockquote' if context[:ignore_blockquotes]
parents.to_set
end
end
def ignored_ancestry?(node)
has_ancestor?(node, IGNORE_PARENTS)
has_ancestor?(node, ignore_parents)
end
def project
......
......@@ -48,7 +48,8 @@ module Gitlab
project: project,
current_user: current_user,
# We don't actually care about the links generated
only_path: true
only_path: true,
ignore_blockquotes: true
}
pipeline = HTML::Pipeline.new([filter], context)
......
......@@ -32,6 +32,10 @@ describe Gitlab::ReferenceExtractor do
```
@bar
```
Quote:
> @offteam
})
expect(subject.users).to eq([])
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