diff --git a/lib/docs/filters/css/entries.rb b/lib/docs/filters/css/entries.rb index ffd8fd0a..f83746b8 100644 --- a/lib/docs/filters/css/entries.rb +++ b/lib/docs/filters/css/entries.rb @@ -105,8 +105,6 @@ module Docs ADDITIONAL_ENTRIES = { 'shape' => [ %w(rect() Syntax) ], - 'uri' => [ - %w(url() The_url()_functional_notation) ], 'timing-function' => [ %w(cubic-bezier() The_cubic-bezier()_class_of_timing-functions), %w(steps() The_steps()_class_of_timing-functions), @@ -118,12 +116,12 @@ module Docs %w(step-start step-start), %w(step-end step-end) ], 'color_value' => [ - %w(transparent transparent_keyword), - %w(currentColor currentcolor_keyword), - %w(rgb() rgb), - %w(hsl() hsl), - %w(rgba() rgba), - %w(hsla() hsla) ]} + %w(transparent transparent), + %w(currentColor currentColor), + %w(rgb() rgba()), + %w(hsl() hsla()), + %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 4a1fc343..ddfa3751 100644 --- a/lib/docs/filters/dom/entries.rb +++ b/lib/docs/filters/dom/entries.rb @@ -7,13 +7,14 @@ module Docs 'OES_' => 'WebGL', 'WEBGL_' => 'WebGL', 'Ambient Light' => 'Ambient Light', + 'Audio' => 'Audio', 'Battery Status' => 'Battery Status', 'Canvas ' => 'Canvas', 'Cooperative Scheduling' => 'Scheduling', 'CSS Font Loading' => 'CSS', 'CSS Object Model' => 'CSS', 'Credential' => 'Credential Management', - 'Cryptography' => 'Web Cryptography', + 'Cryptography' => 'Cryptography', 'Device Orientation' => 'Device Orientation', 'Encoding' => 'Encoding', 'Encrypted Media Extensions' => 'Encrypted Media', @@ -21,33 +22,32 @@ module Docs 'File API' => 'File', 'Geolocation' => 'Geolocation', 'Geometry' => 'Geometry', - 'High Resolution Time' => 'Web Performance', + 'High Resolution Time' => 'Performance', 'Intersection' => 'Intersection Observer', 'Media Capture' => 'Media', - 'Media Session' => 'Media Session', + 'Media Session' => 'Media', 'Media Source' => 'Media', + 'MediaError' => 'Media', 'MediaStream' => 'Media Streams', - 'Navigation Timing' => 'Web Performance', + 'MIDI' => 'Audio', + 'Navigation Timing' => 'Performance', 'Network Information' => 'Network Information', - 'Payment Request' => 'Payment Request', - 'Performance Timeline' => 'Web Performance', + 'Payment' => 'Payments', + 'Performance Timeline' => 'Performance', 'Pointer Events' => 'Pointer Events', 'Push API' => 'Push', 'Presentation API' => 'Presentation', 'Shadow DOM' => 'Shadow DOM', 'Server-Sent Events' => 'Server-Sent Events', 'Service Workers' => 'Service Workers', + 'Speech' => 'Speech', + 'Storage' => 'Storage', 'Stream API' => 'Media Streams', 'Streams' => 'Media Streams', 'Touch Events' => 'Touch Events', 'Web Animations' => 'Animation', 'Web App Manifest' => 'Web App Manifest', - 'Web Audio' => 'Web Audio', - 'Web Budget' => 'Web Budget', - 'Web Messaging' => 'Web Messaging', - 'Web MIDI' => 'Web MIDI', - 'Web Speech' => 'Web Speech', - 'Web Storage' => 'Web Storage', + 'Budget' => 'Budget', 'Web Workers' => 'Web Workers', 'WebGL' => 'WebGL', 'WebRTC' => 'WebRTC', @@ -55,17 +55,22 @@ module Docs TYPE_BY_NAME_STARTS_WITH = { 'Ambient' => 'Ambient Light', - 'Audio' => 'Web Audio', + 'Attr' => 'Nodes', + 'Audio' => 'Audio', + 'BasicCard' => 'Payments', 'Broadcast' => 'Broadcast Channel', - 'Budget' => 'Web Budget', + 'Budget' => 'Budget', 'Canvas' => 'Canvas', 'CSS' => 'CSS', - 'ChildNode' => 'Node', + 'CharacterData' => 'Nodes', + 'ChildNode' => 'Nodes', + 'Comment' => 'Nodes', 'console' => 'Console', 'CustomElement' => 'Custom Elements', 'DataTransfer' => 'Drag & Drop', 'document' => 'Document', 'DocumentFragment' => 'DocumentFragment', + 'DocumentType' => 'Nodes', 'DOM' => 'DOM', 'element' => 'Element', 'event' => 'Event', @@ -80,41 +85,45 @@ module Docs 'IDB' => 'IndexedDB', 'location' => 'Location', 'navigator' => 'Navigator', + 'MediaKeySession' => 'Encrypted Media', 'MediaMetadata' => 'Media Session', 'MediaSession' => 'Media Session', 'MediaTrack' => 'Media Streams', - 'Node' => 'Node', + 'Message' => 'Channel Messaging', + 'NamedNode' => 'Nodes', + 'Node' => 'Nodes', 'Notification' => 'Notification', 'OffscreenCanvas' => 'Canvas', - 'ParentNode' => 'Node', - 'Performance' => 'Web Performance', + 'ParentNode' => 'Nodes', + 'Performance' => 'Performance', 'Presentation' => 'Presentation', 'Push' => 'Push', 'Range' => 'Range', - 'Resource Timing' => 'Web Performance', + 'RenderingContext' => 'Canvas', + 'Resource Timing' => 'Performance', 'RTC' => 'WebRTC', 'screen' => 'Screen', 'Selection' => 'Selection', 'Shadow' => 'Shadow DOM', - 'Storage' => 'Web Storage', 'StyleSheet' => 'CSS', 'Stylesheet' => 'CSS', 'SVG' => 'SVG', 'TimeRanges' => 'Media', - 'timing' => 'Web Performance', - 'Timing' => 'Web Performance', + 'timing' => 'Performance', + 'Timing' => 'Performance', 'Touch' => 'Touch Events', 'TreeWalker' => 'TreeWalker', 'URL' => 'URL', 'VR' => 'WebVR', + 'WebSocket' => 'Web Sockets', 'window' => 'Window', 'Window' => 'Window', 'XMLHttpRequest' => 'XMLHTTPRequest' } TYPE_BY_NAME_INCLUDES = { 'Animation' => 'Animation', - 'ChildNode' => 'Node', - 'Crypto' => 'Web Cryptography', + 'ChildNode' => 'Nodes', + 'Crypto' => 'Cryptography', 'Drag' => 'Drag & Drop', 'FormData' => 'XMLHTTPRequest', 'History' => 'History', @@ -124,37 +133,38 @@ module Docs 'Media Source' => 'Media', 'MediaStream' => 'Media Streams', 'Media Streams' => 'Media Streams', - 'NodeList' => 'Node', + 'Messaging' => 'Channel Messaging', + 'NodeList' => 'Nodes', 'Path2D' => 'Canvas', 'Pointer' => 'Pointer Events', 'Server-sent' => 'Server-Sent Events', 'ServiceWorker' => 'Service Workers', - 'Speech' => 'Web Speech', + 'Speech' => 'Speech', + 'Storage' => 'Storage', 'TextMetrics' => 'Canvas', - 'timing' => 'Web Performance', - 'Timing' => 'Web Performance', - 'udio' => 'Web Audio', - 'WebSocket' => 'Web Sockets', + 'timing' => 'Performance', + 'Timing' => 'Performance', + 'udio' => 'Audio', 'WebGL' => 'WebGL', 'WEBGL' => 'WebGL', 'WebRTC' => 'WebRTC', 'WebVR' => 'WebVR', 'Worker' => 'Web Workers' } - TYPE_BY_NAME_MATCHES = {} + TYPE_BY_NAME_MATCHES = { + /\AText(\z|\.)/ => 'Nodes' + } TYPE_BY_HAS_LINK_TO = { 'DeviceOrientation specification' => 'Device Orientation', 'File System API' => 'File', 'WebSocket' => 'Web Sockets', - 'Web Audio API' => 'Web Audio', + 'Web Audio API' => 'Audio', 'XMLHTTPRequest' => 'XMLHTTPRequest' } CLEANUP_NAMES = %w( CSS\ Object\ Model. - Web\ Audio\ API. - IndexedDB\ API. - MediaRecorder\ API. + Document\ Object\ Model. Tutorial. XMLHttpRequest. ANGLE\ instanced\ arrays.) diff --git a/lib/docs/filters/mdn/clean_html.rb b/lib/docs/filters/mdn/clean_html.rb index bd443cb0..ee151462 100644 --- a/lib/docs/filters/mdn/clean_html.rb +++ b/lib/docs/filters/mdn/clean_html.rb @@ -27,8 +27,12 @@ module Docs css('h2[style]', 'pre[style]', 'th[style]', 'div[style*="line-height"]', 'table[style]', 'pre p[style]').remove_attr('style') + css('strong > code:only-child').each do |node| + node.parent.before(node).remove + end + css('a[title]', 'span[title]').remove_attr('title') - css('a.glossaryLink').remove_attr('class') + css('a.glossaryLink', 'a.external').remove_attr('class') css('*[lang]').remove_attr('lang') css('h2 > a[name]', 'h3 > a[name]').each do |node| @@ -36,6 +40,12 @@ module Docs node.before(node.content).remove end + css('dt > a[id]').each do |node| + next if node['href'] + node.parent['id'] = node['id'] + node.before(node.children).remove + end + css('pre[class^="brush"]').each do |node| node['data-language'] = node['class'][/brush: ?(\w+)/, 1] node.remove_attribute('class')