Skip to content

Commit 6ba2329

Browse files
committed
Update MDN docs
Fixes #719.
1 parent ad9276e commit 6ba2329

File tree

6 files changed

+21
-8
lines changed

6 files changed

+21
-8
lines changed

lib/docs/filters/css/entries.rb

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ class EntriesFilter < Docs::EntriesFilter
77
'CSS_Columns' => 'Multi-column Layout',
88
'CSS_Flexible_Box_Layout' => 'Flexible Box Layout',
99
'CSS_Grid_Layout' => 'Grid Layout',
10-
'CSS_Images' => 'Image Values',
11-
'CSS_Lists_and_Counters' => 'Lists & Counters',
10+
'CSS_Images' => 'Images',
11+
'CSS_Lists_and_Counters' => 'Lists',
1212
'CSS_Transforms' => 'Transforms',
1313
'Media_Queries' => 'Media Queries',
1414
'transform-function' => 'Transforms',
@@ -34,7 +34,7 @@ def get_name
3434
"#{super}()"
3535
elsif slug =~ /\A[a-z]+_/i
3636
slug.to_s.gsub('_', ' ').gsub('/', ': ')
37-
elsif slug.start_with?('transform-function')
37+
elsif slug.start_with?('transform-function') || slug.start_with?('filter-function')
3838
slug.split('/').last + '()'
3939
else
4040
super
@@ -74,9 +74,10 @@ def get_type
7474
'spec-Living' => 0,
7575
'spec-REC' => 1,
7676
'spec-CR' => 2,
77-
'spec-LC' => 3,
78-
'spec-WD' => 4,
79-
'spec-ED' => 5
77+
'spec-PR' => 3,
78+
'spec-LC' => 4,
79+
'spec-WD' => 5,
80+
'spec-ED' => 6
8081
}
8182

8283
PRIORITY_STATUSES = %w(spec-REC spec-CR)
@@ -89,6 +90,8 @@ def get_spec
8990
specs.map! { |node| [node.at_css('> td:nth-child(1) > a'), node.at_css('> td:nth-child(2) > span')] }
9091
# ignore non-CSS specs
9192
specs.select! { |pair| pair.first && pair.first['href'] =~ /css|fxtf|fullscreen|svg/i && !pair.first['href'].include?('compat.spec') }
93+
# ignore specs with no status
94+
specs.select! { |pair| pair.second }
9295
# ["Spec", "spec-REC"]
9396
specs.map! { |pair| [pair.first.child.content, pair.second['class']] }
9497
# sort by status

lib/docs/filters/dom/entries.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ class EntriesFilter < Docs::EntriesFilter
1010
'Audio' => 'Audio',
1111
'Battery Status' => 'Battery Status',
1212
'Canvas ' => 'Canvas',
13+
'Clipboard' => 'Clipboard',
1314
'Cooperative Scheduling' => 'Scheduling',
1415
'CSS Font Loading' => 'CSS',
1516
'CSS Object Model' => 'CSS',
@@ -45,6 +46,7 @@ class EntriesFilter < Docs::EntriesFilter
4546
'Stream API' => 'Media Streams',
4647
'Streams' => 'Media Streams',
4748
'Touch Events' => 'Touch Events',
49+
'Visual Viewport' => 'Visual Viewport',
4850
'Web Animations' => 'Animation',
4951
'Web App Manifest' => 'Web App Manifest',
5052
'Budget' => 'Budget',
@@ -54,13 +56,16 @@ class EntriesFilter < Docs::EntriesFilter
5456
'WebVR' => 'WebVR' }
5557

5658
TYPE_BY_NAME_STARTS_WITH = {
59+
'AbortController' => 'Fetch',
60+
'AbortSignal' => 'Fetch',
5761
'Ambient' => 'Ambient Light',
5862
'Attr' => 'Nodes',
5963
'Audio' => 'Audio',
6064
'BasicCard' => 'Payments',
6165
'Broadcast' => 'Broadcast Channel',
6266
'Budget' => 'Budget',
6367
'Canvas' => 'Canvas',
68+
'Clipboard' => 'Clipboard',
6469
'CSS' => 'CSS',
6570
'CharacterData' => 'Nodes',
6671
'ChildNode' => 'Nodes',
@@ -105,6 +110,7 @@ class EntriesFilter < Docs::EntriesFilter
105110
'screen' => 'Screen',
106111
'Selection' => 'Selection',
107112
'Shadow' => 'Shadow DOM',
113+
'Streams' => 'Media Streams',
108114
'StyleSheet' => 'CSS',
109115
'Stylesheet' => 'CSS',
110116
'SVG' => 'SVG',

lib/docs/filters/javascript/entries.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ module Docs
22
class Javascript
33
class EntriesFilter < Docs::EntriesFilter
44
TYPES = %w(Array ArrayBuffer Atomics Boolean DataView Date Function
5-
Generator Intl JSON Map Math Number Object Promise Reflect RegExp
5+
Generator Intl JSON Map Math Number Object PluralRules Promise Reflect RegExp
66
Set SharedArrayBuffer SIMD String Symbol TypedArray WeakMap WeakSet)
77
INTL_OBJECTS = %w(Collator DateTimeFormat NumberFormat)
88

lib/docs/scrapers/http.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ class Http < Mdn
1111
options[:title] = ->(filter) { filter.current_url.host == 'tools.ietf.org' ? false : filter.default_title }
1212
options[:container] = ->(filter) { filter.current_url.host == 'tools.ietf.org' ? '.content' : nil }
1313
options[:skip_links] = ->(filter) { filter.current_url.host == 'tools.ietf.org' ? true : false }
14+
options[:replace_paths] = { '/Access_control_CORS' => '/CORS' }
1415
options[:fix_urls] = ->(url) do
1516
url.sub! %r{(Status/\d\d\d)_[A-Z].+}, '\1'
1617
url

lib/docs/scrapers/mdn/dom_events.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
module Docs
22
class DomEvents < Mdn
3+
prepend FixInternalUrlsBehavior
4+
35
self.name = 'DOM Events'
46
self.slug = 'dom_events'
57
self.base_url = 'https://developer.mozilla.org/en-US/docs/Web/Events'

lib/docs/scrapers/mdn/mdn.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,15 @@ class Mdn < UrlScraper
99
html_filters.push 'mdn/clean_html'
1010
text_filters.insert_before 'attribution', 'mdn/contribute_link'
1111

12+
options[:rate_limit] = 400
1213
options[:trailing_slash] = false
1314

1415
options[:skip_link] = ->(link) {
1516
link['title'].try(:include?, 'not yet been written'.freeze) && !link['href'].try(:include?, 'transform-function'.freeze)
1617
}
1718

1819
options[:attribution] = <<-HTML
19-
&copy; 2005&ndash;2017 Mozilla Developer Network and individual contributors.<br>
20+
&copy; 2005&ndash;2018 Mozilla Developer Network and individual contributors.<br>
2021
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
2122
HTML
2223

0 commit comments

Comments
 (0)