From ad5b6dbc0968da2aa018696e6e342bc7c64440b5 Mon Sep 17 00:00:00 2001 From: Thibaut Courouble Date: Sat, 25 Mar 2017 12:26:57 -0400 Subject: [PATCH] Update jQuery documentation (3.2.1) Closes #548. --- lib/docs/filters/jquery/clean_html.rb | 4 ++++ lib/docs/filters/jquery_core/entries.rb | 3 ++- lib/docs/scrapers/jquery/jquery.rb | 2 +- lib/docs/scrapers/jquery/jquery_core.rb | 2 +- lib/docs/scrapers/jquery/jquery_mobile.rb | 2 +- 5 files changed, 9 insertions(+), 4 deletions(-) diff --git a/lib/docs/filters/jquery/clean_html.rb b/lib/docs/filters/jquery/clean_html.rb index 787021ec..7420d285 100644 --- a/lib/docs/filters/jquery/clean_html.rb +++ b/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
css('.entry-header > .entry-title', 'header > .underline', 'header > h2:only-child').to_a.uniq.each do |node| node.parent.replace node diff --git a/lib/docs/filters/jquery_core/entries.rb b/lib/docs/filters/jquery_core/entries.rb index c3cb6f53..5b936a74 100644 --- a/lib/docs/filters/jquery_core/entries.rb +++ b/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 } diff --git a/lib/docs/scrapers/jquery/jquery.rb b/lib/docs/scrapers/jquery/jquery.rb index 83c681cd..353909db 100644 --- a/lib/docs/scrapers/jquery/jquery.rb +++ b/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 © The jQuery Foundation and other contributors
diff --git a/lib/docs/scrapers/jquery/jquery_core.rb b/lib/docs/scrapers/jquery/jquery_core.rb index 7584eefd..4688df53 100644 --- a/lib/docs/scrapers/jquery/jquery_core.rb +++ b/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) diff --git a/lib/docs/scrapers/jquery/jquery_mobile.rb b/lib/docs/scrapers/jquery/jquery_mobile.rb index d964b36d..8e5abf1c 100644 --- a/lib/docs/scrapers/jquery/jquery_mobile.rb +++ b/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