diff --git a/assets/stylesheets/pages/_mdn.scss b/assets/stylesheets/pages/_mdn.scss index ba664799..a55ad23e 100644 --- a/assets/stylesheets/pages/_mdn.scss +++ b/assets/stylesheets/pages/_mdn.scss @@ -21,6 +21,7 @@ } > h2 { @extend %block-heading; } + > h3 { @extend %block-label, %label-blue; } > .note, .notice, @@ -87,6 +88,7 @@ dl > dt > code { // CSS property value, Javascript function argument font-family: inherit; font-weight: bold; + font-size: inherit; } .eventinfo { // DOM event diff --git a/lib/docs/filters/css/clean_html.rb b/lib/docs/filters/css/clean_html.rb index 261e1ed1..0ba5b044 100644 --- a/lib/docs/filters/css/clean_html.rb +++ b/lib/docs/filters/css/clean_html.rb @@ -18,6 +18,10 @@ module Docs node.replace node.content end end + + css('img[style*="float"]').each do |node| + node['style'] = node['style'] + ';float: none; display: block;' + end end end end diff --git a/lib/docs/filters/css/entries.rb b/lib/docs/filters/css/entries.rb index 02a5f6fc..e90d79fb 100644 --- a/lib/docs/filters/css/entries.rb +++ b/lib/docs/filters/css/entries.rb @@ -11,7 +11,12 @@ module Docs 'CSS_Transforms' => 'Transforms', 'Media_Queries' => '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 @@ -37,7 +42,9 @@ module Docs end 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! ' Module' type.remove! %r{ Level \d\z} @@ -49,8 +56,6 @@ module Docs type = 'Variables' if type == 'Custom Properties for Cascading Variables' type.prepend 'Miscellaneous ' if type =~ /\ALevel \d\z/ type - elsif type = TYPE_BY_PATH[slug.split('/').first] - type elsif name.start_with?('::') 'Pseudo-Elements' elsif name.start_with?(':') @@ -110,10 +115,10 @@ module Docs 'color_value' => [ %w(transparent transparent_keyword), %w(currentColor currentColor_keyword), - %w(rgb() rgb()), - %w(hsl() hsl()), - %w(rgba() rgba()), - %w(hsla() hsla()) ]} + %w(rgb() rgb), + %w(hsl() hsl), + %w(rgba() rgba), + %w(hsla() hsla) ]} def additional_entries ADDITIONAL_ENTRIES[slug] || [] diff --git a/lib/docs/filters/dom/entries.rb b/lib/docs/filters/dom/entries.rb index 1b61dec9..b18f018a 100644 --- a/lib/docs/filters/dom/entries.rb +++ b/lib/docs/filters/dom/entries.rb @@ -20,9 +20,10 @@ module Docs 'Geolocation' => 'Geolocation', 'Geometry' => 'Geometry', 'High Resolution Time' => 'Web Performance', + 'Intersection' => 'Intersection Observer', 'Media Capture' => 'Media', 'Media Source' => 'Media', - 'MediaStream' => 'Media', + 'MediaStream' => 'Stream', 'Navigation Timing' => 'Web Performance', 'Network Information' => 'Network Information', 'Performance Timeline' => 'Web Performance', @@ -32,8 +33,10 @@ module Docs 'Shadow DOM' => 'Shadow DOM', 'Server-Sent Events' => 'Server-Sent Events', 'Service Workers' => 'Service Workers', + 'Stream API' => 'Stream', 'Touch Events' => 'Touch Events', 'Web Animations' => 'Animation', + 'Web App Manifest' => 'Web App Manifest', 'Web Audio' => 'Web Audio', 'Web Messaging' => 'Web Messaging', 'Web MIDI' => 'Web MIDI', @@ -70,8 +73,10 @@ module Docs 'MediaQuery' => 'MediaQuery', 'Node' => 'Node', 'Notification' => 'Notification', + 'OffscreenCanvas' => 'Canvas', 'ParentNode' => 'Node', 'Performance' => 'Web Performance', + 'Presentation' => 'Presentation', 'Push' => 'Push', 'Range' => 'Range', 'Resource Timing' => 'Web Performance', @@ -87,11 +92,13 @@ module Docs 'Touch' => 'Touch Events', 'TreeWalker' => 'TreeWalker', 'URL' => 'URL', + 'VR' => 'WebVR', 'window' => 'Window', 'Window' => 'Window', 'XMLHttpRequest' => 'XMLHTTPRequest' } TYPE_BY_NAME_INCLUDES = { + 'Animation' => 'Animation', 'ChildNode' => 'Node', 'Crypto' => 'Web Cryptography', 'Drag' => 'Drag & Drop', @@ -101,7 +108,7 @@ module Docs 'ImageData' => 'Canvas', 'IndexedDB' => 'IndexedDB', 'Media Source' => 'Media', - 'MediaStream' => 'Media', + 'MediaStream' => 'Stream', 'NodeList' => 'Node', 'Path2D' => 'Canvas', 'Pointer' => 'Pointer Events', diff --git a/lib/docs/filters/dom_events/entries.rb b/lib/docs/filters/dom_events/entries.rb index 2bf771b3..e56f96cf 100644 --- a/lib/docs/filters/dom_events/entries.rb +++ b/lib/docs/filters/dom_events/entries.rb @@ -34,9 +34,11 @@ module Docs 'Transition' => 'CSS', 'PageTransition' => 'History', 'WebSocket' => 'WebSocket', + 'Web App Manifest' => 'Web App Manifest', 'Web Audio' => 'Web Audio', 'Web Messaging' => 'Web Messaging', 'WebRTC' => 'WebRTC', + 'WebVR' => 'WebVR', 'Wheel' => 'Mouse', 'Worker' => 'Web Workers' } diff --git a/lib/docs/filters/mdn/clean_html.rb b/lib/docs/filters/mdn/clean_html.rb index 4b76965a..d160a184 100644 --- a/lib/docs/filters/mdn/clean_html.rb +++ b/lib/docs/filters/mdn/clean_html.rb @@ -21,11 +21,11 @@ module Docs node.name = 'th' end - css('nobr').each do |node| + css('nobr', 'span[style*="font"]', 'pre code').each do |node| node.before(node.children).remove 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| node.parent['id'] = node['name'] diff --git a/lib/docs/scrapers/mdn/css.rb b/lib/docs/scrapers/mdn/css.rb index 5bf14e59..870d8eee 100644 --- a/lib/docs/scrapers/mdn/css.rb +++ b/lib/docs/scrapers/mdn/css.rb @@ -13,7 +13,12 @@ module Docs options[:skip_patterns] = [/\-webkit/, /\-moz/, /Extensions/, /Tools/] 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 diff --git a/lib/docs/scrapers/mdn/html.rb b/lib/docs/scrapers/mdn/html.rb index b0bee72b..9e5e7c8a 100644 --- a/lib/docs/scrapers/mdn/html.rb +++ b/lib/docs/scrapers/mdn/html.rb @@ -31,5 +31,10 @@ module Docs '/Element/h5' => '/Element/Heading_Elements', '/Element/h6' => '/Element/Heading_Elements', '/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