Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Rust documentation (1.70.0) #2008

Merged
merged 2 commits into from
Jul 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions lib/docs/filters/rust/clean_html.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,9 @@ def call
@doc = at_css('#main, #main-content')

css('.toggle-wrapper').remove
css('.anchor').remove

css('h1.fqn').each do |node|
node.content = node.at_css('.in-band').content
end

css('.main-heading > h1.fqn').each do |node|
css('.main-heading > h1').each do |node|
node.parent.name = 'h1'
node.parent.content = node.content
end
Expand Down Expand Up @@ -107,6 +104,12 @@ def call
node.content = node.content
end

css('.rightside').each do |node|
node.children.each do |child|
child.remove if child.text?() and child.text() == " · "
end
end

css('.since + .srclink').each do |node|
node.previous_element.before(node)
end
Expand Down
6 changes: 3 additions & 3 deletions lib/docs/filters/rust/entries.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def get_name
elsif slug == 'error-index'
'Compiler Errors'
else
name = at_css('h1.fqn .in-band').content.remove(/\A.+\s/).remove('⎘')
name = at_css('main h1').content.remove(/\A.+\s/).remove('⎘')
mod = slug.split('/').first
name.prepend("#{mod}::") unless name.start_with?(mod)
name
Expand All @@ -27,7 +27,7 @@ def get_type
'Compiler Errors'
else
path = name.split('::')
heading = at_css('h1.fqn .in-band').content.strip
heading = at_css('main h1').content.strip
if path.length > 2 || (path.length == 2 && (heading.start_with?('Module') || heading.start_with?('Primitive')))
path[0..1].join('::')
else
Expand All @@ -46,7 +46,7 @@ def additional_entries
else
css('.method')
.each_with_object({}) { |node, entries|
name = node.at_css('.fnname').try(:content)
name = node.at_css('a.fn').try(:content)
next unless name
name.prepend "#{self.name}::"
entries[name] ||= [name, node['id']]
Expand Down
2 changes: 1 addition & 1 deletion lib/docs/scrapers/rust.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
module Docs
class Rust < UrlScraper
self.type = 'rust'
self.release = '1.65.0'
self.release = '1.71.0'
self.base_url = 'https://doc.rust-lang.org/'
self.root_path = 'book/index.html'
self.initial_paths = %w(
Expand Down
Loading