Commit 67996c1e authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch 'rs-search_text_nodes' into 'master'

Use `search_text_nodes` helper in our custom filters

Closes #1477

See merge request !561
parents 1c96b0b9 fb5116ca
...@@ -15,7 +15,7 @@ module Gitlab ...@@ -15,7 +15,7 @@ module Gitlab
IGNORED_ANCESTOR_TAGS = %w(pre code tt).to_set IGNORED_ANCESTOR_TAGS = %w(pre code tt).to_set
def call def call
doc.search('text()').each do |node| search_text_nodes(doc).each do |node|
content = node.to_html content = node.to_html
next unless content.include?(':') next unless content.include?(':')
next if has_ancestor?(node, IGNORED_ANCESTOR_TAGS) next if has_ancestor?(node, IGNORED_ANCESTOR_TAGS)
......
...@@ -49,7 +49,7 @@ module Gitlab ...@@ -49,7 +49,7 @@ module Gitlab
def replace_text_nodes_matching(pattern) def replace_text_nodes_matching(pattern)
return doc if project.nil? return doc if project.nil?
doc.search('text()').each do |node| search_text_nodes(doc).each do |node|
content = node.to_html content = node.to_html
next unless content.match(pattern) next unless content.match(pattern)
......
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