svg.rb 881 B

1234567891011121314151617181920212223242526272829303132
  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'
  8. options[:root_title] = 'SVG'
  9. options[:title] = ->(filter) do
  10. if filter.slug.starts_with?('Element/')
  11. "<#{filter.default_title}>"
  12. elsif filter.slug != 'Attribute' && filter.slug != 'Element'
  13. filter.default_title
  14. else
  15. false
  16. end
  17. end
  18. options[:skip] = %w(/Compatibility_sources /FAQ)
  19. options[:fix_urls] = ->(url) do
  20. url.sub! 'https://developer.mozilla.org/en-US/Web/SVG', Svg.base_url
  21. url.sub! 'https://developer.mozilla.org/en-US/docs/SVG', Svg.base_url
  22. url.sub! 'https://developer.mozilla.org/en/SVG', Svg.base_url
  23. url
  24. end
  25. end
  26. end