From fb125772b9ac535d6e3fdf638803a643ef972cf1 Mon Sep 17 00:00:00 2001 From: Thibaut Date: Sun, 16 Nov 2014 11:35:37 -0500 Subject: [PATCH] Improve DOM scraper --- lib/docs/filters/dom/entries.rb | 6 ++++-- lib/docs/scrapers/mdn/dom.rb | 10 ++++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/lib/docs/filters/dom/entries.rb b/lib/docs/filters/dom/entries.rb index c1808126..af168e56 100644 --- a/lib/docs/filters/dom/entries.rb +++ b/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 diff --git a/lib/docs/scrapers/mdn/dom.rb b/lib/docs/scrapers/mdn/dom.rb index 2d1da9e6..3db5d0b3 100644 --- a/lib/docs/scrapers/mdn/dom.rb +++ b/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?('?')