[devdocsgjs/main: 6/12] Update Socket.IO documentation (4.5.2)




commit d98cd6effaa43646698c6190d9d519da031d1040
Author: Simon Legner <Simon Legner gmail com>
Date:   Tue Sep 20 23:24:00 2022 +0200

    Update Socket.IO documentation (4.5.2)

 assets/stylesheets/application.css.scss |  1 -
 assets/stylesheets/pages/_socketio.scss | 24 ------------------------
 lib/docs/filters/socketio/clean_html.rb | 22 +++++++++++++---------
 lib/docs/scrapers/socketio.rb           |  8 ++++----
 4 files changed, 17 insertions(+), 38 deletions(-)
---
diff --git a/assets/stylesheets/application.css.scss b/assets/stylesheets/application.css.scss
index 66569d69..8a6221b6 100644
--- a/assets/stylesheets/application.css.scss
+++ b/assets/stylesheets/application.css.scss
@@ -115,7 +115,6 @@
         'pages/sanctuary',
         'pages/scala',
         'pages/sinon',
-        'pages/socketio',
         'pages/sphinx',
         'pages/sphinx_simple',
         'pages/sqlite',
diff --git a/lib/docs/filters/socketio/clean_html.rb b/lib/docs/filters/socketio/clean_html.rb
index ec7da521..bd74a9a6 100644
--- a/lib/docs/filters/socketio/clean_html.rb
+++ b/lib/docs/filters/socketio/clean_html.rb
@@ -2,26 +2,30 @@ module Docs
   class Socketio
     class CleanHtmlFilter < Filter
       def call
-        @doc = at_css('article')
+        @doc = at_css('article .theme-doc-markdown')
 
         css('p > br').each do |node|
           node.remove unless node.next.content =~ /\s*\-/
         end
 
-        # version documentation message
-        css('.warning').remove
+        css('header h1').each do |node|
+          node.parent.replace(node)
+        end
+        css('footer', 'aside').remove
 
-        css('header', 'footer', 'aside').remove
+        css('.theme-doc-version-badge', '.theme-doc-toc-mobile', '.admonition-heading', '.hash-link').remove
 
         css('pre').each do |node|
-          if node.at_css('.line').nil?
-            node.content = node.content
-          else
-            node.content = node.css('.line').map(&:content).join("\n")
-          end
+          node.content = node.css('.token-line').map(&:content).join("\n")
+          node.remove_attribute('style')
           node['data-language'] = node.content =~ /\A\s*</ ? 'html' : 'javascript'
+          node.ancestors('.theme-code-block').first.replace(node)
         end
 
+        css('.themedImage--dark_oUvU').remove
+
+        css('*[class]').remove_attribute('class')
+
         doc
       end
     end
diff --git a/lib/docs/scrapers/socketio.rb b/lib/docs/scrapers/socketio.rb
index ec1f0f71..a9c91583 100644
--- a/lib/docs/scrapers/socketio.rb
+++ b/lib/docs/scrapers/socketio.rb
@@ -2,13 +2,13 @@ module Docs
   class Socketio < UrlScraper
     self.name = 'Socket.IO'
     self.slug = 'socketio'
-    self.type = 'socketio'
+    self.type = 'sphinx'
     self.links = {
-      home: 'http://socket.io/',
+      home: 'https://socket.io/',
       code: 'https://github.com/socketio/socket.io'
     }
 
-    html_filters.push 'socketio/clean_html', 'socketio/entries'
+    html_filters.push 'socketio/clean_html', 'socketio/entries', 'sphinx/clean_html'
 
     options[:trailing_slash] = false
     options[:skip] = %w(/faq /glossary)
@@ -19,7 +19,7 @@ module Docs
     HTML
 
     version '4' do
-      self.release = '4.1.2'
+      self.release = '4.5.2'
       self.base_url = "https://socket.io/docs/v#{version}";
     end
 


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