Update Rust documentation (1.10.0)

pull/438/head
Thibaut Courouble 9 years ago
parent 922754ab71
commit a83459be3e

@ -4,7 +4,7 @@ module Docs
def call def call
if slug.start_with?('book') if slug.start_with?('book')
book book
elsif slug.start_with?('reference') elsif slug.start_with?('reference') || slug == 'error-index'
reference reference
else else
api api
@ -41,7 +41,11 @@ module Docs
end end
def reference def reference
css('#versioninfo').remove css('#versioninfo', '.error-undescribed').remove
css('.error-described').each do |node|
node.before(node.children).remove
end
end end
def api def api

@ -6,6 +6,8 @@ module Docs
at_css("#toc a[href='#{File.basename(slug)}']").content at_css("#toc a[href='#{File.basename(slug)}']").content
elsif slug.start_with?('reference') elsif slug.start_with?('reference')
'Reference' 'Reference'
elsif slug == 'error-index'
'Compiler Errors'
else else
name = at_css('h1.fqn .in-band').content.remove(/\A.+\s/) name = at_css('h1.fqn .in-band').content.remove(/\A.+\s/)
mod = slug.split('/').first mod = slug.split('/').first
@ -21,6 +23,8 @@ module Docs
'Guide' 'Guide'
elsif slug.start_with?('reference') elsif slug.start_with?('reference')
'Reference' 'Reference'
elsif slug == 'error-index'
'Compiler Errors'
else else
path = name.split('::') path = name.split('::')
heading = at_css('h1.fqn .in-band').content.strip heading = at_css('h1.fqn .in-band').content.strip
@ -43,6 +47,10 @@ module Docs
id = node['href'].remove('#') id = node['href'].remove('#')
[name, id] [name, id]
end end
elsif slug == 'error-index'
css('.error-described h2.section-header').map do |node|
[node.content, node['id']]
end
else else
css('#methods + * + div > .method', '#required-methods + div > .method', '#provided-methods + div > .method').map do |node| css('#methods + * + div > .method', '#required-methods + div > .method', '#provided-methods + div > .method').map do |node|
name = node.at_css('.fnname').content name = node.at_css('.fnname').content

@ -1,13 +1,14 @@
module Docs module Docs
class Rust < UrlScraper class Rust < UrlScraper
self.type = 'rust' self.type = 'rust'
self.release = '1.9.0' self.release = '1.10.0'
self.base_url = 'https://doc.rust-lang.org/' self.base_url = 'https://doc.rust-lang.org/'
self.root_path = 'book/index.html' self.root_path = 'book/index.html'
self.initial_paths = %w( self.initial_paths = %w(
reference.html reference.html
collections/index.html collections/index.html
std/index.html) std/index.html
error-index.html)
self.links = { self.links = {
home: 'https://www.rust-lang.org/', home: 'https://www.rust-lang.org/',
code: 'https://github.com/rust-lang/rust' code: 'https://github.com/rust-lang/rust'

Loading…
Cancel
Save