http.rb 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. module Docs
  2. class Http < Mdn
  3. include MultipleBaseUrls
  4. # release = '2022-09-21'
  5. self.name = 'HTTP'
  6. self.base_urls = [
  7. 'https://developer.mozilla.org/en-US/docs/Web/HTTP',
  8. 'https://datatracker.ietf.org/doc/html/',
  9. ]
  10. html_filters.push 'http/clean_html', 'http/entries', 'title'
  11. options[:root_title] = 'HTTP'
  12. options[:title] = ->(filter) do
  13. filter.current_url.host == 'datatracker.ietf.org' ? false : filter.default_title
  14. end
  15. options[:container] = ->(filter) do
  16. filter.current_url.host == 'datatracker.ietf.org' ? '.content' : Docs::Mdn.options[:container]
  17. end
  18. options[:skip_links] = ->(filter) do
  19. filter.current_url.host == 'datatracker.ietf.org' ? true : false
  20. end
  21. options[:replace_paths] = { '/Access_control_CORS' => '/CORS' }
  22. options[:fix_urls] = ->(url) do
  23. url.sub! %r{(Status/\d\d\d)_[A-Z].+}, '\1'
  24. url
  25. end
  26. options[:attribution] = ->(filter) do
  27. if filter.current_url.host == 'datatracker.ietf.org'
  28. "&copy; document authors. All rights reserved."
  29. else
  30. Docs::Mdn.options[:attribution]
  31. end
  32. end
  33. def initial_urls
  34. %w(https://developer.mozilla.org/en-US/docs/Web/HTTP
  35. https://datatracker.ietf.org/doc/html/rfc4918
  36. https://datatracker.ietf.org/doc/html/rfc9110
  37. https://datatracker.ietf.org/doc/html/rfc9111
  38. https://datatracker.ietf.org/doc/html/rfc9112
  39. https://datatracker.ietf.org/doc/html/rfc9113
  40. https://datatracker.ietf.org/doc/html/rfc9114
  41. https://datatracker.ietf.org/doc/html/rfc5023)
  42. end
  43. end
  44. end