1
0

http.rb 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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[:fix_urls] = ->(url) do
  12. url.sub! %r{(Status/\d\d\d)_[A-Z].+}, '\1'
  13. url
  14. end
  15. options[:attribution] = ->(filter) do
  16. if filter.current_url.host == 'tools.ietf.org'
  17. "&copy; document authors. All rights reserved."
  18. else
  19. Docs::Mdn.options[:attribution]
  20. end
  21. end
  22. def initial_urls
  23. %w(https://developer.mozilla.org/en-US/docs/Web/HTTP
  24. https://tools.ietf.org/html/rfc2616
  25. https://tools.ietf.org/html/rfc4918
  26. https://tools.ietf.org/html/rfc7230
  27. https://tools.ietf.org/html/rfc7231
  28. https://tools.ietf.org/html/rfc7232
  29. https://tools.ietf.org/html/rfc7233
  30. https://tools.ietf.org/html/rfc7234
  31. https://tools.ietf.org/html/rfc7235
  32. https://tools.ietf.org/html/rfc5023)
  33. end
  34. end
  35. end