Read about our upcoming Code of Conduct on this issue

Commit 3077cb52 authored by Yorick Peterse's avatar Yorick Peterse
Browse files

Use XPath for searching link nodes

This is a tad faster than letting Nokogiri figure out whether it should
evaluate the query as CSS or XPath and then actually evaluating it.
parent 3290cd27d4fb
......@@ -124,7 +124,7 @@ def replace_text_nodes_matching(pattern)
def replace_link_nodes_with_text(pattern)
return doc if project.nil?
doc.search('a').each do |node|
doc.xpath('descendant-or-self::a').each do |node|
klass = node.attr('class')
next if klass && klass.include?('gfm')
......@@ -162,7 +162,7 @@ def replace_link_nodes_with_text(pattern)
def replace_link_nodes_with_href(pattern)
return doc if project.nil?
doc.search('a').each do |node|
doc.xpath('descendant-or-self::a').each do |node|
klass = node.attr('class')
next if klass && klass.include?('gfm')
......
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