Unified · Split
| @@ -4,7 +4,7 @@ module Docs · 3 unmodified lines | ||
| 4 | 4 | def call |
| 5 | 5 | if slug.start_with?('book') |
| 6 | 6 | book |
| 7 | − elsif slug.start_with?('reference') | |
| 7 | + elsif slug.start_with?('reference') || slug == 'error-index' | |
| 8 | 8 | reference |
| 9 | 9 | else |
| 10 | 10 | api |
| @@ -41,7 +41,11 @@ module Docs · 30 unmodified lines | ||
| 41 | 41 | end |
| 42 | 42 | |
| 43 | 43 | def reference |
| 44 | − css('#versioninfo').remove | |
| 44 | + css('#versioninfo', '.error-undescribed').remove | |
| 45 | + | |
| 46 | + css('.error-described').each do |node| | |
| 47 | + node.before(node.children).remove | |
| 48 | + end | |
| 45 | 49 | end |
| 46 | 50 | |
| 47 | 51 | def api |
| @@ -6,6 +6,8 @@ module Docs · 5 unmodified lines | ||
| 6 | 6 | at_css("#toc a[href='#{File.basename(slug)}']").content |
| 7 | 7 | elsif slug.start_with?('reference') |
| 8 | 8 | 'Reference' |
| 9 | + elsif slug == 'error-index' | |
| 10 | + 'Compiler Errors' | |
| 9 | 11 | else |
| 10 | 12 | name = at_css('h1.fqn .in-band').content.remove(/\A.+\s/) |
| 11 | 13 | mod = slug.split('/').first |
| @@ -21,6 +23,8 @@ module Docs · 9 unmodified lines | ||
| 21 | 23 | 'Guide' |
| 22 | 24 | elsif slug.start_with?('reference') |
| 23 | 25 | 'Reference' |
| 26 | + elsif slug == 'error-index' | |
| 27 | + 'Compiler Errors' | |
| 24 | 28 | else |
| 25 | 29 | path = name.split('::') |
| 26 | 30 | heading = at_css('h1.fqn .in-band').content.strip |
| @@ -43,6 +47,10 @@ module Docs · 16 unmodified lines | ||
| 43 | 47 | id = node['href'].remove('#') |
| 44 | 48 | [name, id] |
| 45 | 49 | end |
| 50 | + elsif slug == 'error-index' | |
| 51 | + css('.error-described h2.section-header').map do |node| | |
| 52 | + [node.content, node['id']] | |
| 53 | + end | |
| 46 | 54 | else |
| 47 | 55 | css('#methods + * + div > .method', '#required-methods + div > .method', '#provided-methods + div > .method').map do |node| |
| 48 | 56 | name = node.at_css('.fnname').content |
| @@ -1,13 +1,14 @@ | ||
| 1 | 1 | module Docs |
| 2 | 2 | class Rust < UrlScraper |
| 3 | 3 | self.type = 'rust' |
| 4 | − self.release = '1.9.0' | |
| 4 | + self.release = '1.10.0' | |
| 5 | 5 | self.base_url = 'https://doc.rust-lang.org/' |
| 6 | 6 | self.root_path = 'book/index.html' |
| 7 | 7 | self.initial_paths = %w( |
| 8 | 8 | reference.html |
| 9 | 9 | collections/index.html |
| 10 | − std/index.html) | |
| 10 | + std/index.html | |
| 11 | + error-index.html) | |
| 11 | 12 | self.links = { |
| 12 | 13 | home: 'https://www.rust-lang.org/', |
| 13 | 14 | code: 'https://github.com/rust-lang/rust' |