Commit fb5116ca authored by Robert Speicher's avatar Robert Speicher

Use `search_text_nodes` helper in our custom filters

Closes #1477
parent b5ee60c5
...@@ -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