浏览代码

Add version support

Remove wierd files
dorimon 6 月之前
父节点
当前提交
19696fb368
共有 3 个文件被更改,包括 16 次插入6 次删除
  1. 1 2
      lib/docs/filters/vertx/clean_html.rb
  2. 0 1
      lib/docs/filters/vertx/entries.rb
  3. 15 3
      lib/docs/scrapers/vertx.rb

+ 1 - 2
lib/docs/filters/vertx/clean_html.rb

@@ -2,12 +2,11 @@ module Docs
   class Vertx
   class Vertx
     class CleanHtmlFilter < Filter
     class CleanHtmlFilter < Filter
       def call
       def call
-        css('hr', 'header', 'nav', '.navbar', '.topbar').remove
+        css('footer', 'hr', 'header', 'nav', '.navbar', '.topbar', '.bg-bg-warning').remove
         xpath('//*[@id="docs-layout"]/div/div[3]').remove
         xpath('//*[@id="docs-layout"]/div/div[3]').remove
         xpath('//*[@id="docs-layout"]/div/div[1]').remove
         xpath('//*[@id="docs-layout"]/div/div[1]').remove
         xpath('//main/div[last()]').remove
         xpath('//main/div[last()]').remove
         xpath('//main/div[1]').remove
         xpath('//main/div[1]').remove
-        xpath('//footer').remove
         css('#changelog').remove if root_page?
         css('#changelog').remove if root_page?
 
 
         # Set id attributes on <h3> instead of an empty <a>
         # Set id attributes on <h3> instead of an empty <a>

+ 0 - 1
lib/docs/filters/vertx/entries.rb

@@ -7,7 +7,6 @@ module Docs
         return nil unless node
         return nil unless node
 
 
         result = node.content.strip
         result = node.content.strip
-        result = "v5.0.0 - #{result}" if slug.include?('5.0.0')
         result << ' event' if type == 'Events'
         result << ' event' if type == 'Events'
         result << '()' if node['class'].to_s.include?('function')
         result << '()' if node['class'].to_s.include?('function')
         result
         result

+ 15 - 3
lib/docs/scrapers/vertx.rb

@@ -1,4 +1,3 @@
-
 module Docs
 module Docs
   class Vertx < UrlScraper
   class Vertx < UrlScraper
     self.type = 'vertx'
     self.type = 'vertx'
@@ -9,17 +8,30 @@ module Docs
 
 
     html_filters.push 'vertx/entries', 'vertx/clean_html'
     html_filters.push 'vertx/entries', 'vertx/clean_html'
 
 
-    self.base_url = 'https://vertx.io/'
-    self.root_path = 'docs'
     options[:attribution] = <<-HTML
     options[:attribution] = <<-HTML
       by Dor Sahar :)
       by Dor Sahar :)
     HTML
     HTML
 
 
     options[:skip_patterns] = [
     options[:skip_patterns] = [
       /api/,
       /api/,
+      /5.0.0/,
       /apidocs/,
       /apidocs/,
       /blog/,
       /blog/,
     ]
     ]
 
 
+    version '5.0.0' do
+      self.release = '5.0.0'
+      self.base_url = "https://vertx.io/docs/"
+    end
+
+    version '4.5.15' do
+      self.release = '4.5.15'
+      self.base_url = "https://vertx.io/docs/#{self.version}"
+    end
+
+    version '3.9.16' do
+      self.release = '4.5.15'
+      self.base_url = "https://vertx.io/docs/#{self.version}"
+    end
   end
   end
 end
 end