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
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',
lib/docs/filters/rust/clean_html.rb+5−3
@@ -34,8 +34,10 @@ module Docs · 33 unmodified lines
34 end34 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).remove38 node.first_element_child['id'] = node['name'] || node['id']
39 node.before(node.children).remove
40 end
39 end41 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 end55 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).remove58 node.before(node.children).remove if node.parent.at_css('.srclink').nil?
57 end59 end
58 60
59 css('pre > code').each do |node|61 css('pre > code').each do |node|
lib/docs/filters/rust/entries.rb+1−3
@@ -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_type19 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'
lib/docs/scrapers/rust.rb+3−4
@@ -3,9 +3,9 @@ · 2 unmodified lines
3module Docs3module Docs
4 class Rust < UrlScraper4 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.html10 reference/introduction.html
11 collections/index.html11 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) do29 options[:fix_urls] = ->(url) do