From cce7c4915209980ca4f4bbcb1308b368261804ab Mon Sep 17 00:00:00 2001 From: Enoc Date: Thu, 20 May 2021 00:08:08 -0600 Subject: [PATCH] Update node to 16.2.0. - Fix bugs introduced by new style in code blocks. --- lib/docs/filters/node/clean_html.rb | 22 +++++++++++++++++++--- lib/docs/scrapers/node.rb | 2 +- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/lib/docs/filters/node/clean_html.rb b/lib/docs/filters/node/clean_html.rb index 6c95139b..97b32fef 100644 --- a/lib/docs/filters/node/clean_html.rb +++ b/lib/docs/filters/node/clean_html.rb @@ -4,6 +4,24 @@ module Docs def call css('hr').remove + css('pre').each do |node| + next unless (node.css('code').to_a.length > 1) + + node.css('code').each do |subnode| + + if subnode.classes.include?('mjs') + node.before('

MJS modules

') + elsif subnode.classes.include?('cjs') + node.before('

CJS modules

') + end + + node.before(subnode) + subnode.wrap('
')
+          end
+
+          node.remove
+        end
+
         # Remove "#" links
         css('.mark').each do |node|
           node.parent.parent['id'] = node['id']
@@ -17,9 +35,7 @@ module Docs
         css('pre').each do |node|
           next unless node.at_css('code')
 
-          if lang = node.at_css('code')['class']
-            node['data-language'] = lang.remove(%r{lang(uage)?-})
-          end
+          node['data-language'] = 'js'
 
           node.content = node.content
         end
diff --git a/lib/docs/scrapers/node.rb b/lib/docs/scrapers/node.rb
index a39da5ad..815d61f7 100644
--- a/lib/docs/scrapers/node.rb
+++ b/lib/docs/scrapers/node.rb
@@ -24,7 +24,7 @@ module Docs
     HTML
 
     version do
-      self.release = '16.1.0'
+      self.release = '16.2.0'
       self.base_url = 'https://nodejs.org/api/'
     end