浏览代码

Fix Nokogiri::XML::Node.new deprecation

Passing a Node as the second parameter to Node.new is deprecated. Please pass a Document instead, or prefer an alternative constructor like Node#add_child. This will become an error in a future release of Nokogiri.
Simon Legner 3 年之前
父节点
当前提交
39f8849aef

+ 1 - 1
lib/docs/filters/core/title.rb

@@ -23,7 +23,7 @@ module Docs
     end
 
     def node(content)
-      node = Nokogiri::XML::Node.new 'h1', doc
+      node = Nokogiri::XML::Node.new 'h1', doc.document
       node.content = content
       node
     end

+ 1 - 1
lib/docs/filters/cppref/clean_html.rb

@@ -111,7 +111,7 @@ module Docs
 
         # temporary solution due lack of mathjax/mathml support
         css('.t-mfrac').each do |node|
-          fraction = Nokogiri::XML::Node.new('span', doc)
+          fraction = Nokogiri::XML::Node.new('span', doc.document)
 
           node.css('td').each do |node|
             fraction.add_child("<span>#{node.content}</span>")

+ 1 - 1
lib/docs/filters/django_rest_framework/clean_html.rb

@@ -11,7 +11,7 @@ module Docs
         css('.promo a').remove_attribute('style')
 
         # Translate source files links to DevDocs links
-        links = Nokogiri::XML::Node.new('p', doc)
+        links = Nokogiri::XML::Node.new('p', doc.document)
         links['class'] = '_links'
 
         css('a.github').each do |node|

+ 1 - 1
lib/docs/filters/godot/clean_html.rb

@@ -8,7 +8,7 @@ module Docs
         end
 
         css('ul[id].simple li:first-child:last-child').each do |node|
-          heading = Nokogiri::XML::Node.new 'h3', doc
+          heading = Nokogiri::XML::Node.new 'h3', doc.document
           heading['id'] = node.parent['id']
           heading.children = node.children
           node.parent.before(heading).remove

+ 1 - 1
lib/docs/filters/groovy/clean_html.rb

@@ -2,7 +2,7 @@ module Docs
   class Groovy
     class CleanHtmlFilter < Filter
       def new_node(content)
-        node = Nokogiri::XML::Node.new 'h1', doc
+        node = Nokogiri::XML::Node.new 'h1', doc.document
         node.content = content
         node
       end

+ 1 - 1
lib/docs/filters/mdn/compat_tables.rb

@@ -107,7 +107,7 @@ module Docs
       end
 
       def generate_basic_html_table
-        table = Nokogiri::XML::Node.new('table', doc)
+        table = Nokogiri::XML::Node.new('table', doc.document)
 
         table.add_child('<thead><tr id=bct-browser-type><tr id=bct-browsers><tbody>')
 

+ 1 - 1
lib/docs/filters/rails/clean_html_guides.rb

@@ -7,7 +7,7 @@ module Docs
         at_css('#mainCol').prepend_child at_css('#feature .wrapper').children
         @doc = at_css('#mainCol')
 
-        container = Nokogiri::XML::Node.new 'div', doc
+        container = Nokogiri::XML::Node.new 'div', doc.document
         container['class'] = '_simple'
         container.children = doc.children
         doc << container

+ 1 - 1
lib/docs/filters/rdoc/container.rb

@@ -10,7 +10,7 @@ module Docs
           container = at_css 'main'
 
           # Add <dl> mentioning parent class and included modules
-          meta = Nokogiri::XML::Node.new 'dl', doc
+          meta = Nokogiri::XML::Node.new 'dl', doc.document
           meta['class'] = 'meta'
 
           if parent = at_css('#parent-class-section')

+ 2 - 2
lib/docs/filters/scala/clean_html_v3.rb

@@ -229,14 +229,14 @@ module Docs
       end
 
       def convert_dl_to_table(dl)
-        table = Nokogiri::XML::Node.new('table', doc)
+        table = Nokogiri::XML::Node.new('table', doc.document)
         table['class'] = 'attributes'
 
         dl.css('> dt').each do |dt|
           dd = dt.next_element
           has_dd = dd.name == 'dd' rescue false
 
-          tr = Nokogiri::XML::Node.new('tr', doc)
+          tr = Nokogiri::XML::Node.new('tr', doc.document)
           colspan = has_dd ? '' : ' colspan="2"' # handle <dt> without following <dt>
           tr.add_child("<th#{colspan}>#{dt.inner_html.sub(/:$/, '')}</th>")