svg.rb 910 B

123456789101112131415161718192021222324252627282930313233
  1. module Docs
  2. class Svg < Mdn
  3. prepend FixInternalUrlsBehavior
  4. prepend FixRedirectionsBehavior
  5. # release = '2021-12-21'
  6. self.name = 'SVG'
  7. self.base_url = 'https://developer.mozilla.org/en-US/docs/Web/SVG'
  8. html_filters.push 'svg/clean_html', 'svg/entries'
  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