svg.rb 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. module Docs
  2. class Svg < Mdn
  3. prepend FixInternalUrlsBehavior
  4. prepend FixRedirectionsBehavior
  5. # release = '2022-09-06'
  6. self.name = 'SVG'
  7. self.base_url = 'https://developer.mozilla.org/en-US/docs/Web/SVG'
  8. self.links = {
  9. home: 'https://developer.mozilla.org/en-US/docs/Web/SVG',
  10. code: 'https://github.com/mdn/content/tree/main/files/en-us/web/svg'
  11. }
  12. html_filters.push 'svg/clean_html', 'svg/entries'
  13. options[:root_title] = 'SVG'
  14. options[:title] = ->(filter) do
  15. if filter.slug.starts_with?('Element/')
  16. "<#{filter.default_title}>"
  17. elsif filter.slug != 'Attribute' && filter.slug != 'Element'
  18. filter.default_title
  19. else
  20. false
  21. end
  22. end
  23. options[:skip] = %w(/Compatibility_sources /FAQ)
  24. options[:fix_urls] = ->(url) do
  25. url.sub! 'https://developer.mozilla.org/en-US/Web/SVG', Svg.base_url
  26. url.sub! 'https://developer.mozilla.org/en-US/docs/SVG', Svg.base_url
  27. url.sub! 'https://developer.mozilla.org/en/SVG', Svg.base_url
  28. url
  29. end
  30. end
  31. end