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/javascript.rb

39 lines
1.2 KiB

11 years ago
module Docs
class Javascript < Mdn
self.name = 'JavaScript'
self.base_url = 'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference'
html_filters.push 'javascript/clean_html', 'javascript/entries', 'title'
options[:root_title] = 'JavaScript'
# Don't want
options[:skip] = %w(
/About
/Code_comments
/Deprecated_Features
/Deprecated_and_obsolete_features
/Functions_and_function_scope
/Global_Objects/Iterator
/Global_Objects/Proxy
/Reserved_Words
/arrow_functions
/rest_parameters)
# Duplicates
options[:skip].concat %w(
/Global_Objects
/Operators
/Statements)
options[:fix_urls] = ->(url) do
url.sub! 'https://developer.mozilla.org/en-US/docs/JavaScript/Reference', Javascript.base_url
url.sub! 'https://developer.mozilla.org/en/JavaScript/Reference', Javascript.base_url
url.sub! 'https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference', Javascript.base_url
url.sub! 'https://developer.mozilla.org/En/Core_JavaScript_1.5_Reference', Javascript.base_url
url.sub! '/Operators/Special/', '/Operators/'
url
end
end
end