Browse Source

Improve DOM scraper

Thibaut 11 years ago
parent
commit
fb125772b9
2 changed files with 12 additions and 4 deletions
  1. 4 2
      lib/docs/filters/dom/entries.rb
  2. 8 2
      lib/docs/scrapers/mdn/dom.rb

+ 4 - 2
lib/docs/filters/dom/entries.rb

@@ -33,6 +33,7 @@ module Docs
         'File'                => 'File',
         'GlobalEventHandlers' => 'GlobalEventHandlers',
         'history'             => 'History',
+        'HTML'                => 'Elements',
         'IDB'                 => 'IndexedDB',
         'Location'            => 'Location',
         'navigator'           => 'Navigator',
@@ -59,8 +60,7 @@ module Docs
         'WebGL'     => 'Canvas',
         'Worker'    => 'Web Workers' }
 
-      TYPE_BY_NAME_MATCHES = {
-        /HTML\w*Element/ => 'Elements' }
+      TYPE_BY_NAME_MATCHES = {}
 
       TYPE_BY_HAS_LINK_TO = {
         'DeviceOrientation specification' => 'Device Orientation',
@@ -75,6 +75,7 @@ module Docs
         Web\ Audio\ API.
         IndexedDB\ API.
         MediaRecorder\ API.
+        Tutorial.
         XMLHttpRequest.)
 
       def get_name
@@ -82,6 +83,7 @@ module Docs
         CLEANUP_NAMES.each { |str| name.remove!(str) }
         name.sub! 'Input.', 'HTMLInputElement.'
         name.sub! 'window.navigator', 'navigator'
+        name.sub! 'API.', 'API: '
         # Comment.Comment => Comment.constructor
         name.sub! %r{\A(\w+)\.\1\z}, '\1.constructor' unless name == 'window.window'
         name

+ 8 - 2
lib/docs/scrapers/mdn/dom.rb

@@ -35,6 +35,7 @@ module Docs
       /TCPServerSocket
       /TCPSocket
       /TypeInfo
+      /Using_the_Browser_API
       /Web_Video_Text_Tracks_Format
       /WifiManager
       /window.controllers
@@ -58,7 +59,10 @@ module Docs
       /gamepad/i,
       /UserData/,
       /\A\/Camera/,
+      /\A\/Data_Store_API/,
+      /\A\/DataStore/,
       /\A\/DeviceStorage/,
+      /\A\/DocumentTouch/,
       /\A\/document\.xml/,
       /\A\/XMLDocument/,
       /\A\/DOMCursor/,
@@ -68,7 +72,7 @@ module Docs
       /\A\/navigator\.id/i,
       /\A\/Settings/,
       /\A\/Telephony/,
-      /\A\/Bluetooth/,
+      /Bluetooth/,
       /\A\/Window\.\w+bar/i,
       /\A\/Apps/,
       /\A\/Contact/,
@@ -95,7 +99,9 @@ module Docs
       /form.elements
       /select.type
       /table.rows
-      /XMLHttpRequest/FormData)
+      /XMLHttpRequest/FormData
+      /Performance.now
+      /Document_Object_Model)
 
     options[:fix_urls] = ->(url) do
       return if url.include?('_') || url.include?('?')