rust: proper and working update to 1.37.0

pull/1069/head
Jasper van Merle 6 years ago
parent c6481f4587
commit 212f7ee118

@ -655,7 +655,7 @@ credits = [
'Rust', 'Rust',
'2010 The Rust Project Developers', '2010 The Rust Project Developers',
'MIT', 'MIT',
'https://raw.githubusercontent.com/rust-lang/rust/master/LICENSE-MIT' 'https://raw.githubusercontent.com/rust-lang/book/master/LICENSE-MIT'
], [ ], [
'RxJS', 'RxJS',
'2015-2018 Google, Inc., Netflix, Inc., Microsoft Corp. and contributors', '2015-2018 Google, Inc., Netflix, Inc., Microsoft Corp. and contributors',

@ -34,8 +34,10 @@ module Docs
end end
css('a.header').each do |node| css('a.header').each do |node|
node.first_element_child['id'] = node['name'] || node['id'] unless node.first_element_child.nil?
node.before(node.children).remove node.first_element_child['id'] = node['name'] || node['id']
node.before(node.children).remove
end
end end
css('.docblock > h1:not(.section-header)').each { |node| node.name = 'h4' } css('.docblock > h1:not(.section-header)').each { |node| node.name = 'h4' }
@ -53,7 +55,7 @@ module Docs
end end
css('h1 > a', 'h2 > a', 'h3 > a', 'h4 > a', 'h5 > a').each do |node| 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 end
css('pre > code').each do |node| css('pre > code').each do |node|

@ -17,9 +17,7 @@ module Docs
PRIMITIVE_SLUG = /\A(\w+)\/(primitive)\./ PRIMITIVE_SLUG = /\A(\w+)\/(primitive)\./
def get_type def get_type
if slug.start_with?('book') if slug.start_with?('reference')
'Guide'
elsif slug.start_with?('reference')
'Reference' 'Reference'
elsif slug == 'error-index' elsif slug == 'error-index'
'Compiler Errors' 'Compiler Errors'

@ -5,7 +5,7 @@ module Docs
self.type = 'rust' self.type = 'rust'
self.release = '1.37.0' self.release = '1.37.0'
self.base_url = 'https://doc.rust-lang.org/' 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( self.initial_paths = %w(
reference/introduction.html reference/introduction.html
collections/index.html collections/index.html
@ -19,12 +19,11 @@ module Docs
html_filters.push 'rust/entries', 'rust/clean_html' html_filters.push 'rust/entries', 'rust/clean_html'
options[:only_patterns] = [ options[:only_patterns] = [
/\Abook\/second-edition\//,
/\Areference\//, /\Areference\//,
/\Acollections\//, /\Acollections\//,
/\Astd\// ] /\Astd\// ]
options[:skip] = %w(book/second-edition/README.html) options[:skip] = %w(book/README.html)
options[:skip_patterns] = [/(?<!\.html)\z/, /\/print\.html/] options[:skip_patterns] = [/(?<!\.html)\z/, /\/print\.html/]
options[:fix_urls] = ->(url) do options[:fix_urls] = ->(url) do

Loading…
Cancel
Save