mirror of https://github.com/freeCodeCamp/devdocs
parent
9a97067e06
commit
8a59a660cf
@ -1,17 +1,40 @@
|
|||||||
module Docs
|
module Docs
|
||||||
class Http < UrlScraper
|
class Http < Mdn
|
||||||
|
include MultipleBaseUrls
|
||||||
|
|
||||||
self.name = 'HTTP'
|
self.name = 'HTTP'
|
||||||
self.type = 'rfc'
|
self.base_urls = ['https://developer.mozilla.org/en-US/docs/Web/HTTP', 'https://tools.ietf.org/html/']
|
||||||
self.base_url = 'https://tools.ietf.org/html/'
|
|
||||||
self.initial_paths = %w(rfc2616 rfc4918 rfc7230 rfc7231
|
html_filters.push 'http/clean_html', 'http/entries', 'title'
|
||||||
rfc7232 rfc7233 rfc7234 rfc7235)
|
|
||||||
|
|
||||||
html_filters.push 'http/clean_html', 'http/entries'
|
options[:root_title] = 'HTTP'
|
||||||
|
options[:title] = ->(filter) {
|
||||||
|
filter.current_url.host == 'tools.ietf.org' ? false : filter.default_title
|
||||||
|
}
|
||||||
|
options[:container] = ->(filter) {
|
||||||
|
filter.current_url.host == 'tools.ietf.org' ? '.content' : nil
|
||||||
|
}
|
||||||
|
options[:skip_links] = ->(filter) {
|
||||||
|
filter.current_url.host == 'tools.ietf.org' ? true : false
|
||||||
|
}
|
||||||
|
options[:attribution] = ->(filter) {
|
||||||
|
if filter.current_url.host == 'tools.ietf.org'
|
||||||
|
"© document authors. All rights reserved."
|
||||||
|
else
|
||||||
|
Docs::Mdn.options[:attribution]
|
||||||
|
end
|
||||||
|
}
|
||||||
|
|
||||||
options[:container] = '.content'
|
def initial_urls
|
||||||
options[:skip_links] = true
|
%w(https://developer.mozilla.org/en-US/docs/Web/HTTP
|
||||||
options[:attribution] = <<-HTML
|
https://tools.ietf.org/html/rfc2616
|
||||||
© document authors. All rights reserved.
|
https://tools.ietf.org/html/rfc4918
|
||||||
HTML
|
https://tools.ietf.org/html/rfc7230
|
||||||
|
https://tools.ietf.org/html/rfc7231
|
||||||
|
https://tools.ietf.org/html/rfc7232
|
||||||
|
https://tools.ietf.org/html/rfc7233
|
||||||
|
https://tools.ietf.org/html/rfc7234
|
||||||
|
https://tools.ietf.org/html/rfc7235)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in new issue