1
0

html.rb 1.2 KB

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