瀏覽代碼

Update Angular documentation (12.0.0)

Simon Legner 4 年之前
父節點
當前提交
b5635fa550
共有 2 個文件被更改,包括 23 次插入1 次删除
  1. 2 0
      lib/docs/filters/angular/entries.rb
  2. 21 1
      lib/docs/scrapers/angular.rb

+ 2 - 0
lib/docs/filters/angular/entries.rb

@@ -12,6 +12,8 @@ module Docs
           'Guide'
         elsif slug.start_with?('tutorial')
           'Tutorial'
+        elsif slug.start_with?('api/platform-browser-dynamic')
+          'platform-browser-dynamic'
         elsif node = at_css('th:contains("npm Package")')
           node.next_element.content.remove('@angular/')
         elsif at_css('.api-type-label.module')

+ 21 - 1
lib/docs/scrapers/angular.rb

@@ -59,7 +59,7 @@ module Docs
     end
 
     version do
-      self.release = '11.2.6'
+      self.release = '12.0.0'
       self.base_url = 'https://angular.io/'
       self.root_path = 'docs'
 
@@ -78,6 +78,26 @@ module Docs
       include Docs::Angular::Common
     end
 
+    version '11' do
+      self.release = '11.2.14'
+      self.base_url = 'https://v11.angular.io/'
+      self.root_path = 'docs'
+
+      html_filters.push 'angular/clean_html', 'angular/entries'
+
+      options[:follow_links] = false
+      options[:only_patterns] = [/\Aguide/, /\Atutorial/, /\Aapi/]
+      options[:fix_urls_before_parse] = ->(url) do
+        url.sub! %r{\Aguide/}, '/guide/'
+        url.sub! %r{\Atutorial/}, '/tutorial/'
+        url.sub! %r{\Aapi/}, '/api/'
+        url.sub! %r{\Agenerated/}, '/generated/'
+        url
+      end
+
+      include Docs::Angular::Common
+    end
+
     version '10' do
       self.release = '10.2.3'
       self.base_url = 'https://v10.angular.io/'