Update Rust documentation (1.30.1)

pull/944/head
Thibaut Courouble 6 years ago
parent 3a8be5050b
commit f2faacc50a

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Docs
class Rust
class CleanHtmlFilter < Filter
@ -74,10 +76,10 @@ module Docs
node.remove
end
css('h2 .important-traits', 'h3 .important-traits', 'h4 .important-traits').each do |node|
css('.important-traits').to_a.each_with_index do |node, index|
content = node.at_css('.content.hidden .content')
node.at_css('.content.hidden').replace(content) if content
node.parent.after(node)
node.parent.after(node) if node.parent.name.in?(%(h2 h3 h4))
end
css('code.content').each do |node|

@ -43,13 +43,12 @@ module Docs
end
else
css('.method')
.select {|node| !node.at_css('.fnname').nil?}
.map {|node|
name = node.at_css('.fnname').content
.each_with_object({}) { |node, entries|
name = node.at_css('.fnname').try(:content)
next unless name
name.prepend "#{self.name}::"
[name, node['id']]
}
.uniq {|item| item[0]}
entries[name] ||= [name, node['id']]
}.values
end
end
end

@ -1,7 +1,9 @@
# frozen_string_literal: true
module Docs
class Rust < UrlScraper
self.type = 'rust'
self.release = '1.29.1'
self.release = '1.30.1'
self.base_url = 'https://doc.rust-lang.org/'
self.root_path = 'book/second-edition/index.html'
self.initial_paths = %w(
@ -28,6 +30,7 @@ module Docs
options[:fix_urls] = ->(url) do
url.sub! %r{(#{Rust.base_url}.+/)\z}, '\1index.html'
url.sub! '/unicode/u_str', '/unicode/str/'
url.sub! '/std/std/', '/std/'
url
end

Loading…
Cancel
Save