devdocs/lib/docs/scrapers/mdn/html.rb

33 lines
1 KiB
Ruby
Raw Normal View History

2013-10-24 20:25:52 +02:00
module Docs
class Html < Mdn
2017-07-16 22:54:58 +02:00
prepend FixInternalUrlsBehavior
2024-08-20 20:25:08 +02:00
# release = '2024-08-20'
2013-10-24 20:25:52 +02:00
self.name = 'HTML'
2014-09-07 16:59:59 +02:00
self.base_url = 'https://developer.mozilla.org/en-US/docs/Web/HTML'
2023-04-13 16:14:01 +02:00
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'
}
2013-10-24 20:25:52 +02:00
2021-04-29 22:20:01 +02:00
html_filters.push 'html/clean_html', 'html/entries'
2013-10-24 20:25:52 +02:00
options[:root_title] = 'HTML'
options[:replace_paths] = {
2014-09-07 16:59:59 +02:00
'/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',
2016-05-15 17:28:59 +02:00
'/Element/h6' => '/Element/Heading_Elements',
'/Global_attributes/data-%2A' => '/Global_attributes/data-*' }
2016-07-25 00:48:52 +02:00
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
2021-04-29 22:20:01 +02:00
2013-10-24 20:25:52 +02:00
end
end