From 9098ff5275323dc47cf6e53861dc640a9105b610 Mon Sep 17 00:00:00 2001 From: Thibaut Courouble Date: Sun, 7 Feb 2016 18:02:47 -0500 Subject: [PATCH] Update jQuery docs Closes #204. --- .../templates/pages/about_tmpl.coffee | 6 +++--- lib/docs/filters/jquery/clean_urls.rb | 10 ---------- lib/docs/filters/jquery_core/entries.rb | 1 + lib/docs/scrapers/jquery/jquery.rb | 3 +-- lib/docs/scrapers/jquery/jquery_core.rb | 19 +++++++++++-------- lib/docs/scrapers/jquery/jquery_mobile.rb | 10 +++++++--- lib/docs/scrapers/jquery/jquery_ui.rb | 10 +++++++--- 7 files changed, 30 insertions(+), 29 deletions(-) delete mode 100644 lib/docs/filters/jquery/clean_urls.rb diff --git a/assets/javascripts/templates/pages/about_tmpl.coffee b/assets/javascripts/templates/pages/about_tmpl.coffee index 15702eae..d8cd433f 100644 --- a/assets/javascripts/templates/pages/about_tmpl.coffee +++ b/assets/javascripts/templates/pages/about_tmpl.coffee @@ -191,17 +191,17 @@ credits = [ 'https://raw.githubusercontent.com/iojs/io.js/v1.x/LICENSE' ], [ 'jQuery', - '2009 Packt Publishing
© 2014 jQuery Foundation', + 'Packt Publishing
© jQuery Foundation and other contributors', 'MIT', 'https://raw.githubusercontent.com/jquery/api.jquery.com/master/LICENSE.txt' ], [ 'jQuery Mobile', - '2014 jQuery Foundation', + 'jQuery Foundation and other contributors', 'MIT', 'https://raw.githubusercontent.com/jquery/api.jquerymobile.com/master/LICENSE.txt' ], [ 'jQuery UI', - '2014 jQuery Foundation', + 'jQuery Foundation and other contributors', 'MIT', 'https://raw.githubusercontent.com/jquery/api.jqueryui.com/master/LICENSE.txt' ], [ diff --git a/lib/docs/filters/jquery/clean_urls.rb b/lib/docs/filters/jquery/clean_urls.rb deleted file mode 100644 index a7ad86c0..00000000 --- a/lib/docs/filters/jquery/clean_urls.rb +++ /dev/null @@ -1,10 +0,0 @@ -module Docs - class Jquery - class CleanUrlsFilter < Filter - def call - html.gsub! 'local.api.jquery', 'api.jquery' - html - end - end - end -end diff --git a/lib/docs/filters/jquery_core/entries.rb b/lib/docs/filters/jquery_core/entries.rb index 218be381..c3cb6f53 100644 --- a/lib/docs/filters/jquery_core/entries.rb +++ b/lib/docs/filters/jquery_core/entries.rb @@ -9,6 +9,7 @@ module Docs def get_name name = at_css('h1').content.strip name.gsub!(/ [A-Z]/) { |str| str.downcase! } + name.gsub! %r{[“”]}, '"' name end diff --git a/lib/docs/scrapers/jquery/jquery.rb b/lib/docs/scrapers/jquery/jquery.rb index b01228cd..83c681cd 100644 --- a/lib/docs/scrapers/jquery/jquery.rb +++ b/lib/docs/scrapers/jquery/jquery.rb @@ -4,7 +4,6 @@ module Docs self.type = 'jquery' html_filters.push 'jquery/clean_html', 'title' - text_filters.push 'jquery/clean_urls' options[:title] = false options[:container] = '#content' @@ -12,7 +11,7 @@ module Docs options[:skip_patterns] = [/category/] options[:attribution] = <<-HTML - © 2014 The jQuery Foundation
+ © The jQuery Foundation and other contributors
Licensed under the MIT License. HTML end diff --git a/lib/docs/scrapers/jquery/jquery_core.rb b/lib/docs/scrapers/jquery/jquery_core.rb index 67da4101..0adb68d1 100644 --- a/lib/docs/scrapers/jquery/jquery_core.rb +++ b/lib/docs/scrapers/jquery/jquery_core.rb @@ -1,19 +1,22 @@ module Docs class JqueryCore < Jquery self.name = 'jQuery' - self.release = 'up to 2.1.0' - self.base_url = 'http://local.api.jquery.com' + self.release = 'up to 2.2.0' + self.base_url = 'https://api.jquery.com/' + self.initial_paths = %w(/index/index) html_filters.insert_before 'jquery/clean_html', 'jquery_core/entries' options[:root_title] = 'jQuery' - # Duplicates - options[:skip] = %w(/selectors/odd /selectors/even /selectors/event - /selected /checked) + options[:fix_urls] = ->(url) do + url.sub! 'http://api.jquery.com/', 'https://api.jquery.com/' + end - options[:replace_paths] = { - '/index/' => '/index/index', - '/h/deferred.reject/' => '/deferred.reject' } + options[:skip_patterns] += [ + /h\/deferred\.reject/i, + /Selectors\/odd/i, + /index/i + ] end end diff --git a/lib/docs/scrapers/jquery/jquery_mobile.rb b/lib/docs/scrapers/jquery/jquery_mobile.rb index d2e6162a..d964b36d 100644 --- a/lib/docs/scrapers/jquery/jquery_mobile.rb +++ b/lib/docs/scrapers/jquery/jquery_mobile.rb @@ -2,15 +2,19 @@ module Docs class JqueryMobile < Jquery self.name = 'jQuery Mobile' self.slug = 'jquerymobile' - self.release = '1.4.0' - self.base_url = 'http://local.api.jquerymobile.com' + self.release = '1.4.5' + self.base_url = 'https://api.jquerymobile.com' self.root_path = '/category/all' html_filters.insert_before 'jquery/clean_html', 'jquery_mobile/entries' options[:root_title] = 'jQuery Mobile' options[:skip] = %w(/tabs /theme) - options[:skip_patterns].concat [/\A\/icons/] + options[:skip_patterns].concat [/\A\/icons/, /cdn-cgi/i] options[:replace_paths] = { '/select/' => '/selectmenu' } + + options[:fix_urls] = ->(url) do + url.sub! 'http://api.jquerymobile.com/', 'https://api.jquerymobile.com/' + end end end diff --git a/lib/docs/scrapers/jquery/jquery_ui.rb b/lib/docs/scrapers/jquery/jquery_ui.rb index 4b298c42..660d8f11 100644 --- a/lib/docs/scrapers/jquery/jquery_ui.rb +++ b/lib/docs/scrapers/jquery/jquery_ui.rb @@ -2,14 +2,18 @@ module Docs class JqueryUi < Jquery self.name = 'jQuery UI' self.slug = 'jqueryui' - self.release = '1.10.4' - self.base_url = 'http://local.api.jqueryui.com' + self.release = '1.11.4' + self.base_url = 'https://api.jqueryui.com' self.root_path = '/category/all' html_filters.insert_before 'jquery/clean_html', 'jquery_ui/entries' options[:root_title] = 'jQuery UI' options[:skip] = %w(/theming) - options[:skip_patterns].concat [/\A\/1\./] + options[:skip_patterns] += [/\A\/1\./] + + options[:fix_urls] = ->(url) do + url.sub! 'http://api.jqueryui.com/', 'https://api.jqueryui.com/' + end end end