diff --git a/lib/docs/filters/rust/clean_html.rb b/lib/docs/filters/rust/clean_html.rb index fa24468d..42ac2a83 100644 --- a/lib/docs/filters/rust/clean_html.rb +++ b/lib/docs/filters/rust/clean_html.rb @@ -16,12 +16,9 @@ module Docs @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 @@ -107,6 +104,12 @@ module Docs 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 diff --git a/lib/docs/filters/rust/entries.rb b/lib/docs/filters/rust/entries.rb index 176f7e02..cadb6786 100644 --- a/lib/docs/filters/rust/entries.rb +++ b/lib/docs/filters/rust/entries.rb @@ -9,7 +9,7 @@ module Docs 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 @@ -27,7 +27,7 @@ module Docs '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 @@ -46,7 +46,7 @@ module Docs 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']] diff --git a/lib/docs/scrapers/rust.rb b/lib/docs/scrapers/rust.rb index 270b2e56..7f18e0a3 100644 --- a/lib/docs/scrapers/rust.rb +++ b/lib/docs/scrapers/rust.rb @@ -3,7 +3,7 @@ module Docs class Rust < UrlScraper self.type = 'rust' - self.release = '1.70.0' + self.release = '1.71.0' self.base_url = 'https://doc.rust-lang.org/' self.root_path = 'book/index.html' self.initial_paths = %w(