Bläddra i källkod

Update MDN docs

Fixes #719.
Thibaut Courouble 8 år sedan
förälder
incheckning
6ba23292dc

+ 9 - 6
lib/docs/filters/css/entries.rb

@@ -7,8 +7,8 @@ module Docs
         'CSS_Columns' => 'Multi-column Layout',
         'CSS_Flexible_Box_Layout' => 'Flexible Box Layout',
         'CSS_Grid_Layout' => 'Grid Layout',
-        'CSS_Images' => 'Image Values',
-        'CSS_Lists_and_Counters' => 'Lists & Counters',
+        'CSS_Images' => 'Images',
+        'CSS_Lists_and_Counters' => 'Lists',
         'CSS_Transforms' => 'Transforms',
         'Media_Queries' => 'Media Queries',
         'transform-function' => 'Transforms',
@@ -34,7 +34,7 @@ module Docs
           "#{super}()"
         elsif slug =~ /\A[a-z]+_/i
           slug.to_s.gsub('_', ' ').gsub('/', ': ')
-        elsif slug.start_with?('transform-function')
+        elsif slug.start_with?('transform-function') || slug.start_with?('filter-function')
           slug.split('/').last + '()'
         else
           super
@@ -74,9 +74,10 @@ module Docs
         'spec-Living' => 0,
         'spec-REC'    => 1,
         'spec-CR'     => 2,
-        'spec-LC'     => 3,
-        'spec-WD'     => 4,
-        'spec-ED'     => 5
+        'spec-PR'     => 3,
+        'spec-LC'     => 4,
+        'spec-WD'     => 5,
+        'spec-ED'     => 6
       }
 
       PRIORITY_STATUSES = %w(spec-REC spec-CR)
@@ -89,6 +90,8 @@ module Docs
         specs.map!     { |node| [node.at_css('> td:nth-child(1) > a'), node.at_css('> td:nth-child(2) > span')] }
         # ignore non-CSS specs
         specs.select!  { |pair| pair.first && pair.first['href'] =~ /css|fxtf|fullscreen|svg/i && !pair.first['href'].include?('compat.spec') }
+        # ignore specs with no status
+        specs.select!  { |pair| pair.second }
         # ["Spec", "spec-REC"]
         specs.map!     { |pair| [pair.first.child.content, pair.second['class']] }
         # sort by status

+ 6 - 0
lib/docs/filters/dom/entries.rb

@@ -10,6 +10,7 @@ module Docs
         'Audio'               => 'Audio',
         'Battery Status'      => 'Battery Status',
         'Canvas '             => 'Canvas',
+        'Clipboard'           => 'Clipboard',
         'Cooperative Scheduling' => 'Scheduling',
         'CSS Font Loading'    => 'CSS',
         'CSS Object Model'    => 'CSS',
@@ -45,6 +46,7 @@ module Docs
         'Stream API'          => 'Media Streams',
         'Streams'             => 'Media Streams',
         'Touch Events'        => 'Touch Events',
+        'Visual Viewport'     => 'Visual Viewport',
         'Web Animations'      => 'Animation',
         'Web App Manifest'    => 'Web App Manifest',
         'Budget'              => 'Budget',
@@ -54,6 +56,8 @@ module Docs
         'WebVR'               => 'WebVR' }
 
       TYPE_BY_NAME_STARTS_WITH = {
+        'AbortController'     => 'Fetch',
+        'AbortSignal'         => 'Fetch',
         'Ambient'             => 'Ambient Light',
         'Attr'                => 'Nodes',
         'Audio'               => 'Audio',
@@ -61,6 +65,7 @@ module Docs
         'Broadcast'           => 'Broadcast Channel',
         'Budget'              => 'Budget',
         'Canvas'              => 'Canvas',
+        'Clipboard'           => 'Clipboard',
         'CSS'                 => 'CSS',
         'CharacterData'       => 'Nodes',
         'ChildNode'           => 'Nodes',
@@ -105,6 +110,7 @@ module Docs
         'screen'              => 'Screen',
         'Selection'           => 'Selection',
         'Shadow'              => 'Shadow DOM',
+        'Streams'             => 'Media Streams',
         'StyleSheet'          => 'CSS',
         'Stylesheet'          => 'CSS',
         'SVG'                 => 'SVG',

+ 1 - 1
lib/docs/filters/javascript/entries.rb

@@ -2,7 +2,7 @@ module Docs
   class Javascript
     class EntriesFilter < Docs::EntriesFilter
       TYPES = %w(Array ArrayBuffer Atomics Boolean DataView Date Function
-        Generator Intl JSON Map Math Number Object Promise Reflect RegExp
+        Generator Intl JSON Map Math Number Object PluralRules Promise Reflect RegExp
         Set SharedArrayBuffer SIMD String Symbol TypedArray WeakMap WeakSet)
       INTL_OBJECTS = %w(Collator DateTimeFormat NumberFormat)
 

+ 1 - 0
lib/docs/scrapers/http.rb

@@ -11,6 +11,7 @@ module Docs
     options[:title] = ->(filter) { filter.current_url.host == 'tools.ietf.org' ? false : filter.default_title }
     options[:container] = ->(filter) { filter.current_url.host == 'tools.ietf.org' ? '.content' : nil }
     options[:skip_links] = ->(filter) { filter.current_url.host == 'tools.ietf.org' ? true : false }
+    options[:replace_paths] = { '/Access_control_CORS' => '/CORS' }
     options[:fix_urls] = ->(url) do
       url.sub! %r{(Status/\d\d\d)_[A-Z].+}, '\1'
       url

+ 2 - 0
lib/docs/scrapers/mdn/dom_events.rb

@@ -1,5 +1,7 @@
 module Docs
   class DomEvents < Mdn
+    prepend FixInternalUrlsBehavior
+
     self.name = 'DOM Events'
     self.slug = 'dom_events'
     self.base_url = 'https://developer.mozilla.org/en-US/docs/Web/Events'

+ 2 - 1
lib/docs/scrapers/mdn/mdn.rb

@@ -9,6 +9,7 @@ module Docs
     html_filters.push 'mdn/clean_html'
     text_filters.insert_before 'attribution', 'mdn/contribute_link'
 
+    options[:rate_limit] = 400
     options[:trailing_slash] = false
 
     options[:skip_link] = ->(link) {
@@ -16,7 +17,7 @@ module Docs
     }
 
     options[:attribution] = <<-HTML
-      &copy; 2005&ndash;2017 Mozilla Developer Network and individual contributors.<br>
+      &copy; 2005&ndash;2018 Mozilla Developer Network and individual contributors.<br>
       Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
     HTML