Update MDN docs

pull/447/merge
Thibaut Courouble 9 years ago
parent 7ab536743c
commit 787dc64809

@ -21,6 +21,7 @@
} }
> h2 { @extend %block-heading; } > h2 { @extend %block-heading; }
> h3 { @extend %block-label, %label-blue; }
> .note, > .note,
.notice, .notice,
@ -87,6 +88,7 @@
dl > dt > code { // CSS property value, Javascript function argument dl > dt > code { // CSS property value, Javascript function argument
font-family: inherit; font-family: inherit;
font-weight: bold; font-weight: bold;
font-size: inherit;
} }
.eventinfo { // DOM event .eventinfo { // DOM event

@ -18,6 +18,10 @@ module Docs
node.replace node.content node.replace node.content
end end
end end
css('img[style*="float"]').each do |node|
node['style'] = node['style'] + ';float: none; display: block;'
end
end end
end end
end end

@ -11,7 +11,12 @@ module Docs
'CSS_Transforms' => 'Transforms', 'CSS_Transforms' => 'Transforms',
'Media_Queries' => 'Media Queries', 'Media_Queries' => 'Media Queries',
'@media' => 'Media Queries', '@media' => 'Media Queries',
'transform-function' => 'Transforms' 'transform-function' => 'Transforms',
'text-size-adjust' => 'Miscellaneous',
'resolved_value' => 'Miscellaneous',
'touch-action' => 'Miscellaneous',
'will-change' => 'Miscellaneous',
'align-self' => 'Flexible Box Layout'
} }
DATA_TYPE_SLUGS = %w(angle basic-shape color_value counter frequency DATA_TYPE_SLUGS = %w(angle basic-shape color_value counter frequency
@ -37,7 +42,9 @@ module Docs
end end
def get_type def get_type
if type = get_spec if type = TYPE_BY_PATH[slug.split('/').first]
type
elsif type = get_spec
type.remove! 'CSS ' type.remove! 'CSS '
type.remove! ' Module' type.remove! ' Module'
type.remove! %r{ Level \d\z} type.remove! %r{ Level \d\z}
@ -49,8 +56,6 @@ module Docs
type = 'Variables' if type == 'Custom Properties for Cascading Variables' type = 'Variables' if type == 'Custom Properties for Cascading Variables'
type.prepend 'Miscellaneous ' if type =~ /\ALevel \d\z/ type.prepend 'Miscellaneous ' if type =~ /\ALevel \d\z/
type type
elsif type = TYPE_BY_PATH[slug.split('/').first]
type
elsif name.start_with?('::') elsif name.start_with?('::')
'Pseudo-Elements' 'Pseudo-Elements'
elsif name.start_with?(':') elsif name.start_with?(':')
@ -110,10 +115,10 @@ module Docs
'color_value' => [ 'color_value' => [
%w(transparent transparent_keyword), %w(transparent transparent_keyword),
%w(currentColor currentColor_keyword), %w(currentColor currentColor_keyword),
%w(rgb() rgb()), %w(rgb() rgb),
%w(hsl() hsl()), %w(hsl() hsl),
%w(rgba() rgba()), %w(rgba() rgba),
%w(hsla() hsla()) ]} %w(hsla() hsla) ]}
def additional_entries def additional_entries
ADDITIONAL_ENTRIES[slug] || [] ADDITIONAL_ENTRIES[slug] || []

@ -20,9 +20,10 @@ module Docs
'Geolocation' => 'Geolocation', 'Geolocation' => 'Geolocation',
'Geometry' => 'Geometry', 'Geometry' => 'Geometry',
'High Resolution Time' => 'Web Performance', 'High Resolution Time' => 'Web Performance',
'Intersection' => 'Intersection Observer',
'Media Capture' => 'Media', 'Media Capture' => 'Media',
'Media Source' => 'Media', 'Media Source' => 'Media',
'MediaStream' => 'Media', 'MediaStream' => 'Stream',
'Navigation Timing' => 'Web Performance', 'Navigation Timing' => 'Web Performance',
'Network Information' => 'Network Information', 'Network Information' => 'Network Information',
'Performance Timeline' => 'Web Performance', 'Performance Timeline' => 'Web Performance',
@ -32,8 +33,10 @@ module Docs
'Shadow DOM' => 'Shadow DOM', 'Shadow DOM' => 'Shadow DOM',
'Server-Sent Events' => 'Server-Sent Events', 'Server-Sent Events' => 'Server-Sent Events',
'Service Workers' => 'Service Workers', 'Service Workers' => 'Service Workers',
'Stream API' => 'Stream',
'Touch Events' => 'Touch Events', 'Touch Events' => 'Touch Events',
'Web Animations' => 'Animation', 'Web Animations' => 'Animation',
'Web App Manifest' => 'Web App Manifest',
'Web Audio' => 'Web Audio', 'Web Audio' => 'Web Audio',
'Web Messaging' => 'Web Messaging', 'Web Messaging' => 'Web Messaging',
'Web MIDI' => 'Web MIDI', 'Web MIDI' => 'Web MIDI',
@ -70,8 +73,10 @@ module Docs
'MediaQuery' => 'MediaQuery', 'MediaQuery' => 'MediaQuery',
'Node' => 'Node', 'Node' => 'Node',
'Notification' => 'Notification', 'Notification' => 'Notification',
'OffscreenCanvas' => 'Canvas',
'ParentNode' => 'Node', 'ParentNode' => 'Node',
'Performance' => 'Web Performance', 'Performance' => 'Web Performance',
'Presentation' => 'Presentation',
'Push' => 'Push', 'Push' => 'Push',
'Range' => 'Range', 'Range' => 'Range',
'Resource Timing' => 'Web Performance', 'Resource Timing' => 'Web Performance',
@ -87,11 +92,13 @@ module Docs
'Touch' => 'Touch Events', 'Touch' => 'Touch Events',
'TreeWalker' => 'TreeWalker', 'TreeWalker' => 'TreeWalker',
'URL' => 'URL', 'URL' => 'URL',
'VR' => 'WebVR',
'window' => 'Window', 'window' => 'Window',
'Window' => 'Window', 'Window' => 'Window',
'XMLHttpRequest' => 'XMLHTTPRequest' } 'XMLHttpRequest' => 'XMLHTTPRequest' }
TYPE_BY_NAME_INCLUDES = { TYPE_BY_NAME_INCLUDES = {
'Animation' => 'Animation',
'ChildNode' => 'Node', 'ChildNode' => 'Node',
'Crypto' => 'Web Cryptography', 'Crypto' => 'Web Cryptography',
'Drag' => 'Drag & Drop', 'Drag' => 'Drag & Drop',
@ -101,7 +108,7 @@ module Docs
'ImageData' => 'Canvas', 'ImageData' => 'Canvas',
'IndexedDB' => 'IndexedDB', 'IndexedDB' => 'IndexedDB',
'Media Source' => 'Media', 'Media Source' => 'Media',
'MediaStream' => 'Media', 'MediaStream' => 'Stream',
'NodeList' => 'Node', 'NodeList' => 'Node',
'Path2D' => 'Canvas', 'Path2D' => 'Canvas',
'Pointer' => 'Pointer Events', 'Pointer' => 'Pointer Events',

@ -34,9 +34,11 @@ module Docs
'Transition' => 'CSS', 'Transition' => 'CSS',
'PageTransition' => 'History', 'PageTransition' => 'History',
'WebSocket' => 'WebSocket', 'WebSocket' => 'WebSocket',
'Web App Manifest' => 'Web App Manifest',
'Web Audio' => 'Web Audio', 'Web Audio' => 'Web Audio',
'Web Messaging' => 'Web Messaging', 'Web Messaging' => 'Web Messaging',
'WebRTC' => 'WebRTC', 'WebRTC' => 'WebRTC',
'WebVR' => 'WebVR',
'Wheel' => 'Mouse', 'Wheel' => 'Mouse',
'Worker' => 'Web Workers' } 'Worker' => 'Web Workers' }

@ -21,11 +21,11 @@ module Docs
node.name = 'th' node.name = 'th'
end end
css('nobr').each do |node| css('nobr', 'span[style*="font"]', 'pre code').each do |node|
node.before(node.children).remove node.before(node.children).remove
end end
css('h2[style]', 'pre[style]', 'th[style]', 'div[style*="line-height"]').remove_attr('style') css('h2[style]', 'pre[style]', 'th[style]', 'div[style*="line-height"]', 'table[style]', 'pre p[style]').remove_attr('style')
css('h2 > a[name]', 'h3 > a[name]').each do |node| css('h2 > a[name]', 'h3 > a[name]').each do |node|
node.parent['id'] = node['name'] node.parent['id'] = node['name']

@ -13,7 +13,12 @@ module Docs
options[:skip_patterns] = [/\-webkit/, /\-moz/, /Extensions/, /Tools/] options[:skip_patterns] = [/\-webkit/, /\-moz/, /Extensions/, /Tools/]
options[:replace_paths] = { options[:replace_paths] = {
'/%3Cbasic-shape%3E' => '/basic-shape' '/%3Cbasic-shape%3E' => '/basic-shape',
'/fallback' => '/@counter-style/fallback',
'/range' => '/@counter-style/range',
'/symbols' => '/@counter-style/symbols',
'/system' => '/@counter-style/system',
'/var' => '/var()'
} }
options[:fix_urls] = ->(url) do options[:fix_urls] = ->(url) do

@ -31,5 +31,10 @@ module Docs
'/Element/h5' => '/Element/Heading_Elements', '/Element/h5' => '/Element/Heading_Elements',
'/Element/h6' => '/Element/Heading_Elements', '/Element/h6' => '/Element/Heading_Elements',
'/Global_attributes/data-%2A' => '/Global_attributes/data-*' } '/Global_attributes/data-%2A' => '/Global_attributes/data-*' }
options[:fix_urls] = ->(url) do
url.sub! 'https://developer.mozilla.org/en-US/docs/HTML/', "#{Html.base_url}/" unless url.include?('Content_categories')
url
end
end end
end end

Loading…
Cancel
Save