History

Merge pull request #1069 from simon04/rust

Jasper van Merle committed 7 years ago

Commit 79adb7e2 parents 166e4b5 212f7ee4 files · +10 −11Browse files

Unified · Split

4 files
  1. assets/javascripts/templates/pages/about_tmpl.coffee +1 −1
  2. lib/docs/filters/rust/clean_html.rb +5 −3
  3. lib/docs/filters/rust/entries.rb +1 −3
  4. lib/docs/scrapers/rust.rb +3 −4
assets/javascripts/templates/pages/about_tmpl.coffee+1−1
@@ -655,7 +655,7 @@ credits = [ · 654 unmodified lines
655655 'Rust',
656656 '2010 The Rust Project Developers',
657657 'MIT',
658− 'https://raw.githubusercontent.com/rust-lang/rust/master/LICENSE-MIT'
658+ 'https://raw.githubusercontent.com/rust-lang/book/master/LICENSE-MIT'
659659 ], [
660660 'RxJS',
661661 '2015-2018 Google, Inc., Netflix, Inc., Microsoft Corp. and contributors',
lib/docs/filters/rust/clean_html.rb+5−3
@@ -34,8 +34,10 @@ module Docs · 33 unmodified lines
3434 end
3535
3636 css('a.header').each do |node|
37− node.first_element_child['id'] = node['name'] || node['id']
38− node.before(node.children).remove
37+ unless node.first_element_child.nil?
38+ node.first_element_child['id'] = node['name'] || node['id']
39+ node.before(node.children).remove
40+ end
3941 end
4042
4143 css('.docblock > h1:not(.section-header)').each { |node| node.name = 'h4' }
@@ -53,7 +55,7 @@ module Docs · 11 unmodified lines
5355 end
5456
5557 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?
5759 end
5860
5961 css('pre > code').each do |node|
lib/docs/filters/rust/entries.rb+1−3
@@ -17,9 +17,7 @@ module Docs · 16 unmodified lines
1717 PRIMITIVE_SLUG = /\A(\w+)\/(primitive)\./
1818
1919 def get_type
20− if slug.start_with?('book')
21− 'Guide'
22− elsif slug.start_with?('reference')
20+ if slug.start_with?('reference')
2321 'Reference'
2422 elsif slug == 'error-index'
2523 'Compiler Errors'
lib/docs/scrapers/rust.rb+3−4
@@ -3,9 +3,9 @@ · 2 unmodified lines
33 module Docs
44 class Rust < UrlScraper
55 self.type = 'rust'
6− self.release = '1.30.1'
6+ self.release = '1.37.0'
77 self.base_url = 'https://doc.rust-lang.org/'
8− self.root_path = 'book/second-edition/index.html'
8+ self.root_path = 'book/index.html'
99 self.initial_paths = %w(
1010 reference/introduction.html
1111 collections/index.html
@@ -19,12 +19,11 @@ module Docs · 7 unmodified lines
1919 html_filters.push 'rust/entries', 'rust/clean_html'
2020
2121 options[:only_patterns] = [
22− /\Abook\/second-edition\//,
2322 /\Areference\//,
2423 /\Acollections\//,
2524 /\Astd\// ]
2625
27− options[:skip] = %w(book/second-edition/README.html)
26+ options[:skip] = %w(book/README.html)
2827 options[:skip_patterns] = [/(?<!\.html)\z/, /\/print\.html/]
2928
3029 options[:fix_urls] = ->(url) do