[devdocsgjs/main: 1521/1867] update Ember docs




commit 5c99f2cf24228941544aa5c744e8709e983b5c00
Author: Vadim Kazakov <vkazakov sugarcrm com>
Date:   Sat Feb 20 09:49:16 2021 -0700

    update Ember docs
    
    * better organization of items (put classes at top level)
    * add both v3 and v2 docs

 lib/docs/filters/ember/clean_html.rb |  2 +-
 lib/docs/filters/ember/entries.rb    | 14 ++++++++------
 lib/docs/scrapers/ember.rb           | 23 ++++++++++++++---------
 3 files changed, 23 insertions(+), 16 deletions(-)
---
diff --git a/lib/docs/filters/ember/clean_html.rb b/lib/docs/filters/ember/clean_html.rb
index 031a7951..d33547af 100644
--- a/lib/docs/filters/ember/clean_html.rb
+++ b/lib/docs/filters/ember/clean_html.rb
@@ -2,7 +2,7 @@ module Docs
   class Ember
     class CleanHtmlFilter < Filter
       def call
-        css('hr', '.edit-page', '.heading__link__edit', 'aside').remove
+        css('hr', '.edit-page', '.heading__link__edit', 'aside', '.old-version-warning').remove
 
         base_url.host.start_with?('api') ? api : guide
 
diff --git a/lib/docs/filters/ember/entries.rb b/lib/docs/filters/ember/entries.rb
index e896afad..4c469272 100644
--- a/lib/docs/filters/ember/entries.rb
+++ b/lib/docs/filters/ember/entries.rb
@@ -17,15 +17,17 @@ module Docs
       def get_type
         if base_url.host.start_with?('api')
           name = self.name.remove(/ \(.*/)
-          if name.start_with?('@') || name == 'rsvp'
-            'Packages'
-          elsif name == 'Function'
-            'Functions'
+          if name == 'Function'
+            '3. Functions'
+          elsif at_css('h1').content.start_with?('Package')
+            '2. Packages'
           else
-            'Classes'
+            name = name.remove(' (methods)').remove(' (properties)').remove(' (events)')
+            # Reference gets sorted to the top by default, need to have it with other classes so add a zero 
width space
+            name == 'Reference' ? 'Reference​' : name
           end
         else
-          'Guide'
+          '1. Guide'
         end
       end
 
diff --git a/lib/docs/scrapers/ember.rb b/lib/docs/scrapers/ember.rb
index 5563b522..c5c3ac72 100644
--- a/lib/docs/scrapers/ember.rb
+++ b/lib/docs/scrapers/ember.rb
@@ -7,12 +7,6 @@ module Docs
     self.name = 'Ember.js'
     self.slug = 'ember'
     self.type = 'ember'
-    self.release = '3.25.0'
-    self.base_urls = %w[
-      https://guides.emberjs.com/v3.25.0/
-      https://api.emberjs.com/ember/3.25/
-      https://api.emberjs.com/ember-data/3.25/
-    ]
     self.links = {
       home: 'https://emberjs.com/',
       code: 'https://github.com/emberjs/ember.js'
@@ -54,12 +48,23 @@ module Docs
 
     options[:decode_and_clean_paths] = true # handle paths like @ember/application
 
-    def initial_urls
-      %w(
+    version '3' do
+      self.release = '3.25.0'
+      self.base_urls = %w[
         https://guides.emberjs.com/v3.25.0/
         https://api.emberjs.com/ember/3.25/
         https://api.emberjs.com/ember-data/3.25/
-      )
+      ]
+    end
+
+    version '2' do
+      self.release = '2.18.0'
+      self.base_urls = %w[
+        https://guides.emberjs.com/v2.18.0/
+        https://api.emberjs.com/ember/2.18/
+        https://api.emberjs.com/ember-data/2.18/
+      ]
+      options[:skip_patterns].push(/handlebars-basics$/)
     end
 
     def get_latest_version(opts)


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