History

Update Rust documentation (1.71.0)

Simon Legner committed 3 years ago

Commit 86aafa01 parent 39f0d4d3 files · +12 −9Browse files

Unified · Split

3 files
  1. lib/docs/filters/rust/clean_html.rb +8 −5
  2. lib/docs/filters/rust/entries.rb +3 −3
  3. lib/docs/scrapers/rust.rb +1 −1
lib/docs/filters/rust/clean_html.rb+8−5
@@ -16,12 +16,9 @@ module Docs · 15 unmodified lines
16 @doc = at_css('#main, #main-content')16 @doc = at_css('#main, #main-content')
17 17
18 css('.toggle-wrapper').remove18 css('.toggle-wrapper').remove
19 css('.anchor').remove
19 20
20 css('h1.fqn').each do |node|21 css('.main-heading > h1').each do |node|
21 node.content = node.at_css('.in-band').content
22 end
23
24 css('.main-heading > h1.fqn').each do |node|
25 node.parent.name = 'h1'22 node.parent.name = 'h1'
26 node.parent.content = node.content23 node.parent.content = node.content
27 end24 end
@@ -107,6 +104,12 @@ module Docs · 79 unmodified lines
107 node.content = node.content104 node.content = node.content
108 end105 end
109 106
107 css('.rightside').each do |node|
108 node.children.each do |child|
109 child.remove if child.text?() and child.text() == " · "
110 end
111 end
112
110 css('.since + .srclink').each do |node|113 css('.since + .srclink').each do |node|
111 node.previous_element.before(node)114 node.previous_element.before(node)
112 end115 end
lib/docs/filters/rust/entries.rb+3−3
@@ -9,7 +9,7 @@ module Docs · 8 unmodified lines
9 elsif slug == 'error-index'9 elsif slug == 'error-index'
10 'Compiler Errors'10 'Compiler Errors'
11 else11 else
12 name = at_css('h1.fqn .in-band').content.remove(/\A.+\s/).remove('⎘')12 name = at_css('main h1').content.remove(/\A.+\s/).remove('⎘')
13 mod = slug.split('/').first13 mod = slug.split('/').first
14 name.prepend("#{mod}::") unless name.start_with?(mod)14 name.prepend("#{mod}::") unless name.start_with?(mod)
15 name15 name
@@ -27,7 +27,7 @@ module Docs · 11 unmodified lines
27 'Compiler Errors'27 'Compiler Errors'
28 else28 else
29 path = name.split('::')29 path = name.split('::')
30 heading = at_css('h1.fqn .in-band').content.strip30 heading = at_css('main h1').content.strip
31 if path.length > 2 || (path.length == 2 && (heading.start_with?('Module') || heading.start_with?('Primitive')))31 if path.length > 2 || (path.length == 2 && (heading.start_with?('Module') || heading.start_with?('Primitive')))
32 path[0..1].join('::')32 path[0..1].join('::')
33 else33 else
@@ -46,7 +46,7 @@ module Docs · 12 unmodified lines
46 else46 else
47 css('.method')47 css('.method')
48 .each_with_object({}) { |node, entries|48 .each_with_object({}) { |node, entries|
49 name = node.at_css('.fnname').try(:content)49 name = node.at_css('a.fn').try(:content)
50 next unless name50 next unless name
51 name.prepend "#{self.name}::"51 name.prepend "#{self.name}::"
52 entries[name] ||= [name, node['id']]52 entries[name] ||= [name, node['id']]
lib/docs/scrapers/rust.rb+1−1
@@ -3,7 +3,7 @@ · 2 unmodified lines
3module Docs3module Docs
4 class Rust < UrlScraper4 class Rust < UrlScraper
5 self.type = 'rust'5 self.type = 'rust'
6 self.release = '1.70.0'6 self.release = '1.71.0'
7 self.base_url = 'https://doc.rust-lang.org/'7 self.base_url = 'https://doc.rust-lang.org/'
8 self.root_path = 'book/index.html'8 self.root_path = 'book/index.html'
9 self.initial_paths = %w(9 self.initial_paths = %w(