Update HTTP documentation: HTTP/3, RFC 9110–9114

pull/1824/head
Simon Legner 2 years ago
parent 93e50e8e3f
commit 01d0319c37

@ -1,4 +1,8 @@
[ [
[
"2022-09-21",
"Added HTTP/3 to <a href=\"/http/\">HTTP</a>"
],
[ [
"2022-09-06", "2022-09-06",
"New documentation: <a href=\"/date_fns/\">date-fns</a>" "New documentation: <a href=\"/date_fns/\">date-fns</a>"

@ -25,6 +25,8 @@ module Docs
end end
def ietf def ietf
raise "#{slug} is obsolete!" if at_css('.meta-info *:contains("Obsoleted by")')
@doc = at_css('.draftcontent')
doc.child.remove while doc.child.name != 'pre' doc.child.remove while doc.child.name != 'pre'
css('span.grey', '.invisible', '.noprint', 'a[href^="#page-"]').remove css('span.grey', '.invisible', '.noprint', 'a[href^="#page-"]').remove

@ -44,76 +44,62 @@ module Docs
end end
SECTIONS = { SECTIONS = {
'rfc2616' => [
[3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 15],
[14],
[]
],
'rfc4918' => [ 'rfc4918' => [
[], [],
[11], [11],
[] [], []
], ],
'rfc7230' => [ 'rfc9110' => [
(2..9).to_a, (3..18).to_a,
[], (3..17).to_a,
(7..15).to_a,
[] []
], ],
'rfc7231' => [ 'rfc9111' => [
[3, 8, 9], (3..8).to_a,
(3..10).to_a,
[], [],
[4, 5, 6, 7] [5]
], ],
'rfc7232' => [ 'rfc9112' => [
[5, 6, 7, 8], (2..12).to_a,
[2, 3, 4], (2..11).to_a,
[] [], []
],
'rfc7233' => [
[5, 6],
[2, 3, 4],
[]
],
'rfc7234' => [
[3, 6, 7, 8],
[4, 5],
[]
], ],
'rfc7235' => [ 'rfc9113' => [
[2, 5, 6], (3..11).to_a,
[3, 4], (3..10).to_a,
[] [], []
], ],
'rfc7540' => [ 'rfc9114' => [
(3..11).to_a, (3..11).to_a,
[], (3..10).to_a,
[] [7], []
], ],
'rfc5023' => [ 'rfc5023' => [
[], [], [], [], []
[],
[]
] ]
} }
LEVEL_1 = /\A(\d+)\z/ LEVEL_1 = /\A(\d+)\z/
LEVEL_2 = /\A(\d+)\.\d+\z/ LEVEL_2 = /\A(\d+)\.\d+\z/
LEVEL_3 = /\A(\d+)\.\d+\.\d+\z/ LEVEL_3 = /\A(\d+)\.\d+\.\d+\z/
LEVEL_4 = /\A(\d+)\.\d+\.\d+\.\d+\z/
def additional_entries def additional_entries
return [] unless current_url.host == 'datatracker.ietf.org' return [] unless current_url.host == 'datatracker.ietf.org'
type = nil type = nil
css('a[href^="#section-"]').each_with_object([]) do |node, entries| css('*[id^="section-"]').each_with_object([]) do |node, entries|
id = node['href'].remove('#') id = node['id']
break entries if entries.any? { |e| e[1] == id } break entries if entries.any? { |e| e[1] == id }
content = node.next.content.strip content = node.content.strip
content.remove! %r{\s*\.+\d*\z} content.remove! %r{\s*\.+\d*\z}
content.remove! %r{\A[\.\s]+} content.remove! %r{\A[\.\s]+}
name = "#{content} (#{rfc})" name = "#{content} (#{rfc})"
number = node.content.strip number = id.remove('section-')
if number =~ LEVEL_1 if number =~ LEVEL_1
if SECTIONS[slug][0].include?($1.to_i) if SECTIONS[slug][0].include?($1.to_i)
@ -131,7 +117,11 @@ module Docs
type = self.name type = self.name
end end
elsif (number =~ LEVEL_2 && SECTIONS[slug][1].include?($1.to_i)) || elsif (number =~ LEVEL_2 && SECTIONS[slug][1].include?($1.to_i)) ||
(number =~ LEVEL_3 && SECTIONS[slug][2].include?($1.to_i)) (number =~ LEVEL_3 && SECTIONS[slug][2].include?($1.to_i)) ||
(number =~ LEVEL_4 && SECTIONS[slug][3].include?($1.to_i))
if type != self.name
name.remove! %r{\A(\d+\.)* }
end
entries << [name, id, (name =~ /\A\d\d\d/ ? 'Status' : type )] entries << [name, id, (name =~ /\A\d\d\d/ ? 'Status' : type )]
end end
end end

@ -2,7 +2,7 @@ module Docs
class Http < Mdn class Http < Mdn
include MultipleBaseUrls include MultipleBaseUrls
# release = '2022-09-20' # release = '2022-09-21'
self.name = 'HTTP' self.name = 'HTTP'
self.base_urls = [ self.base_urls = [
'https://developer.mozilla.org/en-US/docs/Web/HTTP', 'https://developer.mozilla.org/en-US/docs/Web/HTTP',
@ -16,7 +16,7 @@ module Docs
filter.current_url.host == 'datatracker.ietf.org' ? false : filter.default_title filter.current_url.host == 'datatracker.ietf.org' ? false : filter.default_title
end end
options[:container] = ->(filter) do options[:container] = ->(filter) do
filter.current_url.host == 'datatracker.ietf.org' ? '.content .draftcontent' : Docs::Mdn.options[:container] filter.current_url.host == 'datatracker.ietf.org' ? '.content' : Docs::Mdn.options[:container]
end end
options[:skip_links] = ->(filter) do options[:skip_links] = ->(filter) do
filter.current_url.host == 'datatracker.ietf.org' ? true : false filter.current_url.host == 'datatracker.ietf.org' ? true : false
@ -37,15 +37,12 @@ module Docs
def initial_urls def initial_urls
%w(https://developer.mozilla.org/en-US/docs/Web/HTTP %w(https://developer.mozilla.org/en-US/docs/Web/HTTP
https://datatracker.ietf.org/doc/html/rfc2616
https://datatracker.ietf.org/doc/html/rfc4918 https://datatracker.ietf.org/doc/html/rfc4918
https://datatracker.ietf.org/doc/html/rfc7230 https://datatracker.ietf.org/doc/html/rfc9110
https://datatracker.ietf.org/doc/html/rfc7231 https://datatracker.ietf.org/doc/html/rfc9111
https://datatracker.ietf.org/doc/html/rfc7232 https://datatracker.ietf.org/doc/html/rfc9112
https://datatracker.ietf.org/doc/html/rfc7233 https://datatracker.ietf.org/doc/html/rfc9113
https://datatracker.ietf.org/doc/html/rfc7234 https://datatracker.ietf.org/doc/html/rfc9114
https://datatracker.ietf.org/doc/html/rfc7235
https://datatracker.ietf.org/doc/html/rfc7540
https://datatracker.ietf.org/doc/html/rfc5023) https://datatracker.ietf.org/doc/html/rfc5023)
end end
end end

Loading…
Cancel
Save