History

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

Simon Legner committed 4 years ago

Commit 01d03191 parent 93e50e84 files · +44 −51Browse files

Unified · Split

4 files
  1. assets/javascripts/news.json +4 −0
  2. lib/docs/filters/http/clean_html.rb +2 −0
  3. lib/docs/filters/http/entries.rb +31 −41
  4. lib/docs/scrapers/http.rb +7 −10
assets/javascripts/news.json+4−0
@@ -1,4 +1,8 @@
11 [
2+ [
3+ "2022-09-21",
4+ "Added HTTP/3 to <a href=\"/http/\">HTTP</a>"
5+ ],
26 [
37 "2022-09-06",
48 "New documentation: <a href=\"/date_fns/\">date-fns</a>"
lib/docs/filters/http/clean_html.rb+2−0
@@ -25,6 +25,8 @@ module Docs · 24 unmodified lines
2525 end
2626
2727 def ietf
28+ raise "#{slug} is obsolete!" if at_css('.meta-info *:contains("Obsoleted by")')
29+ @doc = at_css('.draftcontent')
2830 doc.child.remove while doc.child.name != 'pre'
2931
3032 css('span.grey', '.invisible', '.noprint', 'a[href^="#page-"]').remove
lib/docs/filters/http/entries.rb+31−41
@@ -44,76 +44,62 @@ module Docs · 43 unmodified lines
4444 end
4545
4646 SECTIONS = {
47− 'rfc2616' => [
48− [3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 15],
49− [14],
50− []
51− ],
5247 'rfc4918' => [
5348 [],
5449 [11],
55− []
50+ [], []
5651 ],
57− 'rfc7230' => [
58− (2..9).to_a,
59− [],
52+ 'rfc9110' => [
53+ (3..18).to_a,
54+ (3..17).to_a,
55+ (7..15).to_a,
6056 []
6157 ],
62− 'rfc7231' => [
63− [3, 8, 9],
58+ 'rfc9111' => [
59+ (3..8).to_a,
60+ (3..10).to_a,
6461 [],
65− [4, 5, 6, 7]
62+ [5]
6663 ],
67− 'rfc7232' => [
68− [5, 6, 7, 8],
69− [2, 3, 4],
70− []
71− ],
72− 'rfc7233' => [
73− [5, 6],
74− [2, 3, 4],
75− []
76− ],
77− 'rfc7234' => [
78− [3, 6, 7, 8],
79− [4, 5],
80− []
64+ 'rfc9112' => [
65+ (2..12).to_a,
66+ (2..11).to_a,
67+ [], []
8168 ],
82− 'rfc7235' => [
83− [2, 5, 6],
84− [3, 4],
85− []
69+ 'rfc9113' => [
70+ (3..11).to_a,
71+ (3..10).to_a,
72+ [], []
8673 ],
87− 'rfc7540' => [
74+ 'rfc9114' => [
8875 (3..11).to_a,
89− [],
90− []
76+ (3..10).to_a,
77+ [7], []
9178 ],
9279 'rfc5023' => [
93− [],
94− [],
95− []
80+ [], [], [], []
9681 ]
9782 }
9883
9984 LEVEL_1 = /\A(\d+)\z/
10085 LEVEL_2 = /\A(\d+)\.\d+\z/
10186 LEVEL_3 = /\A(\d+)\.\d+\.\d+\z/
87+ LEVEL_4 = /\A(\d+)\.\d+\.\d+\.\d+\z/
10288
10389 def additional_entries
10490 return [] unless current_url.host == 'datatracker.ietf.org'
10591 type = nil
10692
107− css('a[href^="#section-"]').each_with_object([]) do |node, entries|
108− id = node['href'].remove('#')
93+ css('*[id^="section-"]').each_with_object([]) do |node, entries|
94+ id = node['id']
10995 break entries if entries.any? { |e| e[1] == id }
11096
111− content = node.next.content.strip
97+ content = node.content.strip
11298 content.remove! %r{\s*\.+\d*\z}
11399 content.remove! %r{\A[\.\s]+}
114100
115101 name = "#{content} (#{rfc})"
116− number = node.content.strip
102+ number = id.remove('section-')
117103
118104 if number =~ LEVEL_1
119105 if SECTIONS[slug][0].include?($1.to_i)
@@ -131,7 +117,11 @@ module Docs · 11 unmodified lines
131117 type = self.name
132118 end
133119 elsif (number =~ LEVEL_2 && SECTIONS[slug][1].include?($1.to_i)) ||
134− (number =~ LEVEL_3 && SECTIONS[slug][2].include?($1.to_i))
120+ (number =~ LEVEL_3 && SECTIONS[slug][2].include?($1.to_i)) ||
121+ (number =~ LEVEL_4 && SECTIONS[slug][3].include?($1.to_i))
122+ if type != self.name
123+ name.remove! %r{\A(\d+\.)* }
124+ end
135125 entries << [name, id, (name =~ /\A\d\d\d/ ? 'Status' : type )]
136126 end
137127 end
lib/docs/scrapers/http.rb+7−10
@@ -2,7 +2,7 @@ module Docs · 1 unmodified line
22 class Http < Mdn
33 include MultipleBaseUrls
44
5− # release = '2022-09-20'
5+ # release = '2022-09-21'
66 self.name = 'HTTP'
77 self.base_urls = [
88 'https://developer.mozilla.org/en-US/docs/Web/HTTP',
@@ -16,7 +16,7 @@ module Docs · 7 unmodified lines
1616 filter.current_url.host == 'datatracker.ietf.org' ? false : filter.default_title
1717 end
1818 options[:container] = ->(filter) do
19− filter.current_url.host == 'datatracker.ietf.org' ? '.content .draftcontent' : Docs::Mdn.options[:container]
19+ filter.current_url.host == 'datatracker.ietf.org' ? '.content' : Docs::Mdn.options[:container]
2020 end
2121 options[:skip_links] = ->(filter) do
2222 filter.current_url.host == 'datatracker.ietf.org' ? true : false
@@ -37,15 +37,12 @@ module Docs · 14 unmodified lines
3737
3838 def initial_urls
3939 %w(https://developer.mozilla.org/en-US/docs/Web/HTTP
40− https://datatracker.ietf.org/doc/html/rfc2616
4140 https://datatracker.ietf.org/doc/html/rfc4918
42− https://datatracker.ietf.org/doc/html/rfc7230
43− https://datatracker.ietf.org/doc/html/rfc7231
44− https://datatracker.ietf.org/doc/html/rfc7232
45− https://datatracker.ietf.org/doc/html/rfc7233
46− https://datatracker.ietf.org/doc/html/rfc7234
47− https://datatracker.ietf.org/doc/html/rfc7235
48− https://datatracker.ietf.org/doc/html/rfc7540
41+ https://datatracker.ietf.org/doc/html/rfc9110
42+ https://datatracker.ietf.org/doc/html/rfc9111
43+ https://datatracker.ietf.org/doc/html/rfc9112
44+ https://datatracker.ietf.org/doc/html/rfc9113
45+ https://datatracker.ietf.org/doc/html/rfc9114
4946 https://datatracker.ietf.org/doc/html/rfc5023)
5047 end
5148 end

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t