html.rb 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. module Docs
  2. class Html < Mdn
  3. self.name = 'HTML'
  4. self.base_url = 'https://developer.mozilla.org/en-US/docs/Web/HTML'
  5. html_filters.push 'html/clean_html', 'html/entries', 'title'
  6. options[:root_title] = 'HTML'
  7. options[:title] = ->(filter) do
  8. if filter.slug == 'Element/Heading_Elements'
  9. 'Heading Elements'
  10. elsif filter.slug.start_with?('Element/')
  11. "<#{filter.default_title}>"
  12. else
  13. filter.default_title
  14. end
  15. end
  16. options[:skip] = %w(
  17. /index
  18. /Element/shadow
  19. /Element/webkit-meter-optimum-value
  20. )
  21. options[:replace_paths] = {
  22. '/Element/h1' => '/Element/Heading_Elements',
  23. '/Element/h2' => '/Element/Heading_Elements',
  24. '/Element/h3' => '/Element/Heading_Elements',
  25. '/Element/h4' => '/Element/Heading_Elements',
  26. '/Element/h5' => '/Element/Heading_Elements',
  27. '/Element/h6' => '/Element/Heading_Elements',
  28. '/Global_attributes/data-%2A' => '/Global_attributes/data-*' }
  29. options[:fix_urls] = ->(url) do
  30. url.sub! 'https://developer.mozilla.org/en-US/docs/HTML/', "#{Html.base_url}/" unless url.include?('Content_categories')
  31. url
  32. end
  33. end
  34. end