You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
devdocs/lib/docs/scrapers/mdn/dom.rb

86 lines
2.8 KiB

11 years ago
module Docs
class Dom < Mdn
self.name = 'DOM'
self.base_url = 'https://developer.mozilla.org/en-US/docs/Web/API'
self.fix_redirections = true
11 years ago
html_filters.push 'dom/clean_html', 'dom/entries', 'title'
options[:root_title] = 'DOM'
options[:skip] = %w(
/Reference
/Index
/Document_Object_Model
/document/createProcessingInstruction
/document/documentURIObject
/document/loadOverlay
/document/tooltipNode
9 years ago
/Document/cookie/Simple_document.cookie_framework
11 years ago
/DOMErrorHandler
/DOMLocator
/DOMObject
/DOMStringList
/Event/Comparison_of_Event_Targets
/IDBDatabaseException
11 years ago
/IndexedDB_API/Using_JavaScript_Generators_in_Firefox
11 years ago
/Notation
/ProcessingInstruction
/TypeInfo
/window/getAttention
/window/messageManager
/window/updateCommands
/window/pkcs11
/OES_texture_float)
11 years ago
options[:skip_patterns] = [
/NS/,
/XPC/,
/moz/i,
/gecko/i,
/webkit/i,
/gamepad/i,
/UserData/,
/Bluetooth/,
/FMRadio/i,
/XDomainRequest/i,
11 years ago
/\A\/Camera/,
/\A\/Data_Store_API/,
/\A\/DataStore/,
11 years ago
/\A\/DeviceStorage/,
/\A\/DocumentTouch/,
/\A\/document\/xml/,
/\A\/XMLDocument/,
11 years ago
/\A\/DOMCursor/,
/\A\/DOMRequest/,
10 years ago
/\A\/InstallTrigger/,
11 years ago
/\A\/Entity/,
/\A\/Settings/,
/telephony/i,
10 years ago
/\A\/NFC_API/,
/\A\/Window\/\w+bar/i,
/\A\/Apps/,
/\A\/Contact/,
/\A\/L10n/,
/\A\/Permission/]
11 years ago
options[:fix_urls] = ->(url) do
return if url.include?('_') || url.include?('?')
url.sub! 'https://developer.mozilla.org/en-US/docs/DOM/', "#{Dom.base_url}/"
url.sub! 'https://developer.mozilla.org/en/DOM/', "#{Dom.base_url}/"
url.sub! "#{Dom.base_url}/Console", "#{Dom.base_url}/console"
url.sub! "#{Dom.base_url}/Document\/", "#{Dom.base_url}/document\/"
11 years ago
url.sub! "#{Dom.base_url}/Element", "#{Dom.base_url}/element"
url.sub! "#{Dom.base_url}/History", "#{Dom.base_url}/history"
url.sub! "#{Dom.base_url}/Location", "#{Dom.base_url}/location"
11 years ago
url.sub! "#{Dom.base_url}/Navigator", "#{Dom.base_url}/navigator"
url.sub! "#{Dom.base_url}/Screen", "#{Dom.base_url}/screen"
url.sub! "#{Dom.base_url}/Window\/", "#{Dom.base_url}/window\/"
11 years ago
url.sub! "#{Dom.base_url}/notification", "#{Dom.base_url}/Notification"
url.sub! "#{Dom.base_url}/range", "#{Dom.base_url}/Range"
url.sub! "#{Dom.base_url}/event", "#{Dom.base_url}/Event"
11 years ago
url
end
end
end