Update MDN docs

Fixes #719.
pull/739/merge
Thibaut Courouble 7 years ago
parent ad9276e901
commit 6ba23292dc

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

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

@ -2,7 +2,7 @@ module Docs
class Javascript class Javascript
class EntriesFilter < Docs::EntriesFilter class EntriesFilter < Docs::EntriesFilter
TYPES = %w(Array ArrayBuffer Atomics Boolean DataView Date Function 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) Set SharedArrayBuffer SIMD String Symbol TypedArray WeakMap WeakSet)
INTL_OBJECTS = %w(Collator DateTimeFormat NumberFormat) INTL_OBJECTS = %w(Collator DateTimeFormat NumberFormat)

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

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

@ -9,6 +9,7 @@ module Docs
html_filters.push 'mdn/clean_html' html_filters.push 'mdn/clean_html'
text_filters.insert_before 'attribution', 'mdn/contribute_link' text_filters.insert_before 'attribution', 'mdn/contribute_link'
options[:rate_limit] = 400
options[:trailing_slash] = false options[:trailing_slash] = false
options[:skip_link] = ->(link) { options[:skip_link] = ->(link) {
@ -16,7 +17,7 @@ module Docs
} }
options[:attribution] = <<-HTML 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. Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
HTML HTML

Loading…
Cancel
Save