浏览代码

Update Vue Router documentation (3.5.1 and 4.0.3)

Simon Legner 4 年之前
父节点
当前提交
b724e81d2f
共有 2 个文件被更改,包括 19 次插入4 次删除
  1. 8 1
      lib/docs/filters/vue_router/clean_html.rb
  2. 11 3
      lib/docs/scrapers/vue_router.rb

+ 8 - 1
lib/docs/filters/vue_router/clean_html.rb

@@ -2,7 +2,7 @@ module Docs
   class VueRouter
     class CleanHtmlFilter < Filter
       def call
-        @doc = at_css('.content')
+        @doc = at_css('main')
 
         # Remove unneeded elements
         css('.bit-sponsor, .header-anchor').remove
@@ -14,6 +14,13 @@ module Docs
           title.name = 'strong' unless title.nil?
         end
 
+        # Remove data-v-* attributes
+        css('*').each do |node|
+          node.attributes.each_key do |attribute|
+            node.remove_attribute(attribute) if attribute.start_with? 'data-v-'
+          end
+        end
+
         doc
       end
     end

+ 11 - 3
lib/docs/scrapers/vue_router.rb

@@ -3,8 +3,6 @@ module Docs
     self.name = 'Vue Router'
     self.slug = 'vue_router'
     self.type = 'simple'
-    self.release = '3.1.2'
-    self.base_url = 'https://router.vuejs.org/'
     self.links = {
       home: 'https://router.vuejs.org',
       code: 'https://github.com/vuejs/vue-router'
@@ -22,8 +20,18 @@ module Docs
       Licensed under the MIT License.
     HTML
 
+    version '4' do
+      self.release = '4.0.3'
+      self.base_url = 'https://next.router.vuejs.org/'
+    end
+
+    version '3' do
+      self.release = '3.5.1'
+      self.base_url = 'https://router.vuejs.org/'
+    end
+
     def get_latest_version(opts)
-      get_latest_github_release('vuejs', 'vue-router', opts)
+      get_npm_version('vue-router', opts, 'next')
     end
   end
 end