瀏覽代碼

Update Koa documentation (3.0.0)

Simon Legner 6 月之前
父節點
當前提交
040082f6eb
共有 1 個文件被更改,包括 31 次插入8 次删除
  1. 31 8
      lib/docs/scrapers/koa.rb

+ 31 - 8
lib/docs/scrapers/koa.rb

@@ -2,10 +2,6 @@
 
 module Docs
   class Koa < Github
-    self.base_url = 'https://github.com/koajs/koa/blob/master/docs'
-    self.release = '2.15.0'
-
-    self.root_path = 'api/index.md'
     self.initial_paths = %w[
       error-handling
       faq
@@ -30,16 +26,43 @@ module Docs
     options[:trailing_slash] = false
     options[:container] = '.markdown-body'
 
-    options[:fix_urls] = ->(url) do
-      url.sub! 'https://koajs.com/#error-handling', Koa.base_url + '/error-handling.md'
-      url
-    end
+
 
     options[:attribution] = <<-HTML
       &copy; 2020 Koa contributors<br>
       Licensed under the MIT License.
     HTML
 
+    version do
+      self.base_url = 'https://github.com/koajs/koa/blob/v3.0.0/docs'
+      self.root_path = 'api/index.md'
+      self.release = '3.0.0'
+      options[:fix_urls] = ->(url) do
+        url.sub! 'https://koajs.com/#error-handling', self.base_url + '/error-handling.md'
+        url
+      end
+    end
+    
+    version '2' do
+      self.base_url = 'https://github.com/koajs/koa/blob/v2.16.1/docs'
+      self.root_path = 'api/index.md'
+      self.release = '2.16.1'
+      options[:fix_urls] = ->(url) do
+        url.sub! 'https://koajs.com/#error-handling', self.base_url + '/error-handling.md'
+        url
+      end
+    end
+    
+    version '1' do
+      self.base_url = 'https://github.com/koajs/koa/blob/1.7.1/docs'
+      self.root_path = 'api/index.md'
+      self.release = '1.7.1'
+      options[:fix_urls] = ->(url) do
+        url.sub! 'https://koajs.com/#error-handling', self.base_url + '/error-handling.md'
+        url
+      end
+    end
+    
     def get_latest_version(opts)
       get_npm_version('koa', opts)
     end