[devdocsgjs/main: 22/69] Fix Nokogiri::XML::Node.new deprecation




commit 39f8849aefbeb3d541ad323a277ba4baeeb9c84e
Author: Simon Legner <Simon Legner gmail com>
Date:   Sat Aug 27 19:35:44 2022 +0200

    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.

 lib/docs/filters/core/title.rb                       | 2 +-
 lib/docs/filters/cppref/clean_html.rb                | 2 +-
 lib/docs/filters/django_rest_framework/clean_html.rb | 2 +-
 lib/docs/filters/godot/clean_html.rb                 | 2 +-
 lib/docs/filters/groovy/clean_html.rb                | 2 +-
 lib/docs/filters/mdn/compat_tables.rb                | 2 +-
 lib/docs/filters/rails/clean_html_guides.rb          | 2 +-
 lib/docs/filters/rdoc/container.rb                   | 2 +-
 lib/docs/filters/scala/clean_html_v3.rb              | 4 ++--
 9 files changed, 10 insertions(+), 10 deletions(-)
---
diff --git a/lib/docs/filters/core/title.rb b/lib/docs/filters/core/title.rb
index 1d4eb88a..28f9e408 100644
--- a/lib/docs/filters/core/title.rb
+++ b/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
diff --git a/lib/docs/filters/cppref/clean_html.rb b/lib/docs/filters/cppref/clean_html.rb
index 07acfd45..7c65c726 100644
--- a/lib/docs/filters/cppref/clean_html.rb
+++ b/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>")
diff --git a/lib/docs/filters/django_rest_framework/clean_html.rb 
b/lib/docs/filters/django_rest_framework/clean_html.rb
index 67c131bb..47efdfa7 100644
--- a/lib/docs/filters/django_rest_framework/clean_html.rb
+++ b/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|
diff --git a/lib/docs/filters/godot/clean_html.rb b/lib/docs/filters/godot/clean_html.rb
index 1a1adc6b..165d756d 100644
--- a/lib/docs/filters/godot/clean_html.rb
+++ b/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
diff --git a/lib/docs/filters/groovy/clean_html.rb b/lib/docs/filters/groovy/clean_html.rb
index baf88527..e07d1790 100755
--- a/lib/docs/filters/groovy/clean_html.rb
+++ b/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
diff --git a/lib/docs/filters/mdn/compat_tables.rb b/lib/docs/filters/mdn/compat_tables.rb
index 285a26b0..b9891db1 100644
--- a/lib/docs/filters/mdn/compat_tables.rb
+++ b/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>')
 
diff --git a/lib/docs/filters/rails/clean_html_guides.rb b/lib/docs/filters/rails/clean_html_guides.rb
index 0c39d137..bd8ad439 100644
--- a/lib/docs/filters/rails/clean_html_guides.rb
+++ b/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
diff --git a/lib/docs/filters/rdoc/container.rb b/lib/docs/filters/rdoc/container.rb
index e7211fc6..aea2b0f5 100644
--- a/lib/docs/filters/rdoc/container.rb
+++ b/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')
diff --git a/lib/docs/filters/scala/clean_html_v3.rb b/lib/docs/filters/scala/clean_html_v3.rb
index 28c090fd..4c447c28 100644
--- a/lib/docs/filters/scala/clean_html_v3.rb
+++ b/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>")
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]