Unified · Split
| @@ -655,7 +655,7 @@ credits = [ · 654 unmodified lines | |||
| 655 | 'Rust', | 655 | 'Rust', |
| 656 | '2010 The Rust Project Developers', | 656 | '2010 The Rust Project Developers', |
| 657 | 'MIT', | 657 | 'MIT', |
| 658 | 'https://raw.githubusercontent.com/rust-lang/rust/master/LICENSE-MIT' | 658 | 'https://raw.githubusercontent.com/rust-lang/book/master/LICENSE-MIT' |
| 659 | ], [ | 659 | ], [ |
| 660 | 'RxJS', | 660 | 'RxJS', |
| 661 | '2015-2018 Google, Inc., Netflix, Inc., Microsoft Corp. and contributors', | 661 | '2015-2018 Google, Inc., Netflix, Inc., Microsoft Corp. and contributors', |
| @@ -34,8 +34,10 @@ module Docs · 33 unmodified lines | |||
| 34 | end | 34 | end |
| 35 | 35 | ||
| 36 | css('a.header').each do |node| | 36 | css('a.header').each do |node| |
| 37 | node.first_element_child['id'] = node['name'] || node['id'] | 37 | unless node.first_element_child.nil? |
| 38 | node.before(node.children).remove | 38 | node.first_element_child['id'] = node['name'] || node['id'] |
| 39 | node.before(node.children).remove | ||
| 40 | end | ||
| 39 | end | 41 | end |
| 40 | 42 | ||
| 41 | css('.docblock > h1:not(.section-header)').each { |node| node.name = 'h4' } | 43 | css('.docblock > h1:not(.section-header)').each { |node| node.name = 'h4' } |
| @@ -53,7 +55,7 @@ module Docs · 11 unmodified lines | |||
| 53 | end | 55 | end |
| 54 | 56 | ||
| 55 | css('h1 > a', 'h2 > a', 'h3 > a', 'h4 > a', 'h5 > a').each do |node| | 57 | css('h1 > a', 'h2 > a', 'h3 > a', 'h4 > a', 'h5 > a').each do |node| |
| 56 | node.before(node.children).remove | 58 | node.before(node.children).remove if node.parent.at_css('.srclink').nil? |
| 57 | end | 59 | end |
| 58 | 60 | ||
| 59 | css('pre > code').each do |node| | 61 | css('pre > code').each do |node| |
| @@ -17,9 +17,7 @@ module Docs · 16 unmodified lines | |||
| 17 | PRIMITIVE_SLUG = /\A(\w+)\/(primitive)\./ | 17 | PRIMITIVE_SLUG = /\A(\w+)\/(primitive)\./ |
| 18 | 18 | ||
| 19 | def get_type | 19 | def get_type |
| 20 | if slug.start_with?('book') | 20 | if slug.start_with?('reference') |
| 21 | 'Guide' | ||
| 22 | elsif slug.start_with?('reference') | ||
| 23 | 'Reference' | 21 | 'Reference' |
| 24 | elsif slug == 'error-index' | 22 | elsif slug == 'error-index' |
| 25 | 'Compiler Errors' | 23 | 'Compiler Errors' |
| @@ -3,9 +3,9 @@ · 2 unmodified lines | |||
| 3 | module Docs | 3 | module Docs |
| 4 | class Rust < UrlScraper | 4 | class Rust < UrlScraper |
| 5 | self.type = 'rust' | 5 | self.type = 'rust' |
| 6 | self.release = '1.30.1' | 6 | self.release = '1.37.0' |
| 7 | self.base_url = 'https://doc.rust-lang.org/' | 7 | self.base_url = 'https://doc.rust-lang.org/' |
| 8 | self.root_path = 'book/second-edition/index.html' | 8 | self.root_path = 'book/index.html' |
| 9 | self.initial_paths = %w( | 9 | self.initial_paths = %w( |
| 10 | reference/introduction.html | 10 | reference/introduction.html |
| 11 | collections/index.html | 11 | collections/index.html |
| @@ -19,12 +19,11 @@ module Docs · 7 unmodified lines | |||
| 19 | html_filters.push 'rust/entries', 'rust/clean_html' | 19 | html_filters.push 'rust/entries', 'rust/clean_html' |
| 20 | 20 | ||
| 21 | options[:only_patterns] = [ | 21 | options[:only_patterns] = [ |
| 22 | /\Abook\/second-edition\//, | ||
| 23 | /\Areference\//, | 22 | /\Areference\//, |
| 24 | /\Acollections\//, | 23 | /\Acollections\//, |
| 25 | /\Astd\// ] | 24 | /\Astd\// ] |
| 26 | 25 | ||
| 27 | options[:skip] = %w(book/second-edition/README.html) | 26 | options[:skip] = %w(book/README.html) |
| 28 | options[:skip_patterns] = [/(?<!\.html)\z/, /\/print\.html/] | 27 | options[:skip_patterns] = [/(?<!\.html)\z/, /\/print\.html/] |
| 29 | 28 | ||
| 30 | options[:fix_urls] = ->(url) do | 29 | options[:fix_urls] = ->(url) do |