svg.rb 884 B

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