svg.rb 932 B

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