Browse Source

Update jQuery documentation (3.2.1)

Closes #548.
Thibaut Courouble 8 years ago
parent
commit
ad5b6dbc09

+ 4 - 0
lib/docs/filters/jquery/clean_html.rb

@@ -18,6 +18,10 @@ module Docs
           end
         end
 
+        css('.page-header', 'h1 span').each do |node|
+          node.before(node.children).remove
+        end
+
         # Remove useless <header>
         css('.entry-header > .entry-title', 'header > .underline', 'header > h2:only-child').to_a.uniq.each do |node|
           node.parent.replace node

+ 2 - 1
lib/docs/filters/jquery_core/entries.rb

@@ -8,12 +8,13 @@ module Docs
 
       def get_name
         name = at_css('h1').content.strip
-        name.gsub!(/ [A-Z]/) { |str| str.downcase! }
+        name.gsub!(/ [A-Z]/) { |str| str.downcase! } unless name.start_with?('Category')
         name.gsub! %r{[“”]}, '"'
         name
       end
 
       def get_type
+        return 'Categories' if slug.start_with?('category')
         return 'Ajax' if slug == 'Ajax_Events'
         categories = css 'span.category'
         types = categories.map { |node| node.at_css('a').content.strip }

+ 1 - 1
lib/docs/scrapers/jquery/jquery.rb

@@ -8,7 +8,7 @@ module Docs
     options[:title] = false
     options[:container] = '#content'
     options[:trailing_slash] = false
-    options[:skip_patterns] = [/category/]
+    options[:skip_patterns] = [/deprecated/, /category\/version/]
 
     options[:attribution] = <<-HTML
       &copy; The jQuery Foundation and other contributors<br>

+ 1 - 1
lib/docs/scrapers/jquery/jquery_core.rb

@@ -1,7 +1,7 @@
 module Docs
   class JqueryCore < Jquery
     self.name = 'jQuery'
-    self.release = 'up to 3.1.1'
+    self.release = 'up to 3.2.1'
     self.base_url = 'https://api.jquery.com/'
     self.initial_paths = %w(/index/index)
 

+ 1 - 1
lib/docs/scrapers/jquery/jquery_mobile.rb

@@ -10,7 +10,7 @@ module Docs
 
     options[:root_title] = 'jQuery Mobile'
     options[:skip] = %w(/tabs /theme)
-    options[:skip_patterns].concat [/\A\/icons/, /cdn-cgi/i]
+    options[:skip_patterns] += [/\A\/icons/, /cdn-cgi/i]
     options[:replace_paths] = { '/select/' => '/selectmenu' }
 
     options[:fix_urls] = ->(url) do