svg.rb 854 B

12345678910111213141516171819202122232425262728293031
  1. module Docs
  2. class Svg < Mdn
  3. include FixRedirectionsBehavior
  4. self.name = 'SVG'
  5. self.base_url = 'https://developer.mozilla.org/en-US/docs/Web/SVG'
  6. html_filters.push 'svg/clean_html', 'svg/entries', 'title'
  7. options[:root_title] = 'SVG'
  8. options[:title] = ->(filter) do
  9. if filter.slug.starts_with?('Element/')
  10. "<#{filter.default_title}>"
  11. elsif filter.slug != 'Attribute' && filter.slug != 'Element'
  12. filter.default_title
  13. else
  14. false
  15. end
  16. end
  17. options[:skip] = %w(/Compatibility_sources /FAQ)
  18. options[:fix_urls] = ->(url) do
  19. url.sub! 'https://developer.mozilla.org/en-US/Web/SVG', Svg.base_url
  20. url.sub! 'https://developer.mozilla.org/en-US/docs/SVG', Svg.base_url
  21. url.sub! 'https://developer.mozilla.org/en/SVG', Svg.base_url
  22. url
  23. end
  24. end
  25. end