Skip to content

Commit

Permalink
Merge pull request #2008 from rondDev/patch-1
Browse files Browse the repository at this point in the history
Update Rust documentation (1.70.0)
  • Loading branch information
simon04 authored Jul 26, 2023
2 parents 20f6d9d + 86aafa0 commit ffcb1f1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
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

0 comments on commit ffcb1f1

Please sign in to comment.