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
1616 @doc = at_css('#main, #main-content')
1717
1818 css('.toggle-wrapper').remove
19+ css('.anchor').remove
1920
20− css('h1.fqn').each do |node|
21− node.content = node.at_css('.in-band').content
22− end
23−
24− css('.main-heading > h1.fqn').each do |node|
21+ css('.main-heading > h1').each do |node|
2522 node.parent.name = 'h1'
2623 node.parent.content = node.content
2724 end
@@ -107,6 +104,12 @@ module Docs · 79 unmodified lines
107104 node.content = node.content
108105 end
109106
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+
110113 css('.since + .srclink').each do |node|
111114 node.previous_element.before(node)
112115 end
lib/docs/filters/rust/entries.rb+3−3
@@ -9,7 +9,7 @@ module Docs · 8 unmodified lines
99 elsif slug == 'error-index'
1010 'Compiler Errors'
1111 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('⎘')
1313 mod = slug.split('/').first
1414 name.prepend("#{mod}::") unless name.start_with?(mod)
1515 name
@@ -27,7 +27,7 @@ module Docs · 11 unmodified lines
2727 'Compiler Errors'
2828 else
2929 path = name.split('::')
30− heading = at_css('h1.fqn .in-band').content.strip
30+ heading = at_css('main h1').content.strip
3131 if path.length > 2 || (path.length == 2 && (heading.start_with?('Module') || heading.start_with?('Primitive')))
3232 path[0..1].join('::')
3333 else
@@ -46,7 +46,7 @@ module Docs · 12 unmodified lines
4646 else
4747 css('.method')
4848 .each_with_object({}) { |node, entries|
49− name = node.at_css('.fnname').try(:content)
49+ name = node.at_css('a.fn').try(:content)
5050 next unless name
5151 name.prepend "#{self.name}::"
5252 entries[name] ||= [name, node['id']]
lib/docs/scrapers/rust.rb+1−1
@@ -3,7 +3,7 @@ · 2 unmodified lines
33 module Docs
44 class Rust < UrlScraper
55 self.type = 'rust'
6− self.release = '1.70.0'
6+ self.release = '1.71.0'
77 self.base_url = 'https://doc.rust-lang.org/'
88 self.root_path = 'book/index.html'
99 self.initial_paths = %w(