html.rb 944 B

1234567891011121314151617181920212223242526272829303132
  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. self.root_path = '/Element'
  6. self.initial_paths = %w(/Attributes)
  7. html_filters.push 'html/clean_html', 'html/entries', 'title'
  8. options[:root_title] = 'HTML'
  9. options[:title] = ->(filter) do
  10. if filter.slug == 'Element/Heading_Elements'
  11. 'Heading Elements'
  12. elsif filter.slug == 'Attributes'
  13. 'Attributes'
  14. else
  15. "<#{filter.default_title}>"
  16. end
  17. end
  18. options[:only_patterns] = [/\A\/Element/]
  19. options[:replace_paths] = {
  20. '/Element/h1' => '/Element/Heading_Elements',
  21. '/Element/h2' => '/Element/Heading_Elements',
  22. '/Element/h3' => '/Element/Heading_Elements',
  23. '/Element/h4' => '/Element/Heading_Elements',
  24. '/Element/h5' => '/Element/Heading_Elements',
  25. '/Element/h6' => '/Element/Heading_Elements' }
  26. end
  27. end