[devdocsgjs/main: 873/1867] rust: proper and working update to 1.37.0




commit 212f7ee118d7e9bac4249f5ac52e110ffcad84fb
Author: Jasper van Merle <jaspervmerle gmail com>
Date:   Thu Aug 22 21:49:11 2019 +0200

    rust: proper and working update to 1.37.0

 assets/javascripts/templates/pages/about_tmpl.coffee | 2 +-
 lib/docs/filters/rust/clean_html.rb                  | 8 +++++---
 lib/docs/filters/rust/entries.rb                     | 4 +---
 lib/docs/scrapers/rust.rb                            | 5 ++---
 4 files changed, 9 insertions(+), 10 deletions(-)
---
diff --git a/assets/javascripts/templates/pages/about_tmpl.coffee 
b/assets/javascripts/templates/pages/about_tmpl.coffee
index 4ec24e0e..265fdb31 100644
--- a/assets/javascripts/templates/pages/about_tmpl.coffee
+++ b/assets/javascripts/templates/pages/about_tmpl.coffee
@@ -655,7 +655,7 @@ credits = [
     'Rust',
     '2010 The Rust Project Developers',
     'MIT',
-    'https://raw.githubusercontent.com/rust-lang/rust/master/LICENSE-MIT'
+    'https://raw.githubusercontent.com/rust-lang/book/master/LICENSE-MIT'
   ], [
     'RxJS',
     '2015-2018 Google, Inc., Netflix, Inc., Microsoft Corp. and contributors',
diff --git a/lib/docs/filters/rust/clean_html.rb b/lib/docs/filters/rust/clean_html.rb
index db07a9ed..55c55417 100644
--- a/lib/docs/filters/rust/clean_html.rb
+++ b/lib/docs/filters/rust/clean_html.rb
@@ -34,8 +34,10 @@ module Docs
         end
 
         css('a.header').each do |node|
-          node.first_element_child['id'] = node['name'] || node['id']
-          node.before(node.children).remove
+          unless node.first_element_child.nil?
+            node.first_element_child['id'] = node['name'] || node['id']
+            node.before(node.children).remove
+          end
         end
 
         css('.docblock > h1:not(.section-header)').each { |node| node.name = 'h4' }
@@ -53,7 +55,7 @@ module Docs
         end
 
         css('h1 > a', 'h2 > a', 'h3 > a', 'h4 > a', 'h5 > a').each do |node|
-          node.before(node.children).remove
+          node.before(node.children).remove if node.parent.at_css('.srclink').nil?
         end
 
         css('pre > code').each do |node|
diff --git a/lib/docs/filters/rust/entries.rb b/lib/docs/filters/rust/entries.rb
index 524342fc..03d08783 100644
--- a/lib/docs/filters/rust/entries.rb
+++ b/lib/docs/filters/rust/entries.rb
@@ -17,9 +17,7 @@ module Docs
       PRIMITIVE_SLUG = /\A(\w+)\/(primitive)\./
 
       def get_type
-        if slug.start_with?('book')
-          'Guide'
-        elsif slug.start_with?('reference')
+        if slug.start_with?('reference')
           'Reference'
         elsif slug == 'error-index'
           'Compiler Errors'
diff --git a/lib/docs/scrapers/rust.rb b/lib/docs/scrapers/rust.rb
index 2948f934..aa443450 100644
--- a/lib/docs/scrapers/rust.rb
+++ b/lib/docs/scrapers/rust.rb
@@ -5,7 +5,7 @@ module Docs
     self.type = 'rust'
     self.release = '1.37.0'
     self.base_url = 'https://doc.rust-lang.org/'
-    self.root_path = 'book/second-edition/index.html'
+    self.root_path = 'book/index.html'
     self.initial_paths = %w(
       reference/introduction.html
       collections/index.html
@@ -19,12 +19,11 @@ module Docs
     html_filters.push 'rust/entries', 'rust/clean_html'
 
     options[:only_patterns] = [
-      /\Abook\/second-edition\//,
       /\Areference\//,
       /\Acollections\//,
       /\Astd\// ]
 
-    options[:skip] = %w(book/second-edition/README.html)
+    options[:skip] = %w(book/README.html)
     options[:skip_patterns] = [/(?<!\.html)\z/, /\/print\.html/]
 
     options[:fix_urls] = ->(url) do


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]