http.rb 1.5 KB

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