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

33 lines
1.0 KiB

11 years ago
module Docs
class Html < Mdn
prepend FixInternalUrlsBehavior
# release = '2023-10-24'
11 years ago
self.name = 'HTML'
self.base_url = 'https://developer.mozilla.org/en-US/docs/Web/HTML'
self.links = {
home: 'https://developer.mozilla.org/en-US/docs/Web/HTML',
code: 'https://github.com/mdn/content/tree/main/files/en-us/web/html'
}
11 years ago
html_filters.push 'html/clean_html', 'html/entries'
11 years ago
options[:root_title] = 'HTML'
options[:replace_paths] = {
'/Element/h1' => '/Element/Heading_Elements',
'/Element/h2' => '/Element/Heading_Elements',
'/Element/h3' => '/Element/Heading_Elements',
'/Element/h4' => '/Element/Heading_Elements',
'/Element/h5' => '/Element/Heading_Elements',
9 years ago
'/Element/h6' => '/Element/Heading_Elements',
'/Global_attributes/data-%2A' => '/Global_attributes/data-*' }
9 years ago
options[:fix_urls] = ->(url) do
url.sub! 'https://developer.mozilla.org/en-US/docs/HTML/', "#{Html.base_url}/" unless url.include?('Content_categories')
url
end
11 years ago
end
end