Skip to content

Commit 73a41a1

Browse files
committed
Update Rust documentation (1.28.0)
1 parent fff3bc2 commit 73a41a1

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

lib/docs/filters/rust/clean_html.rb

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ def call
55
puts subpath if at_css('#versioninfo')
66

77
if slug.start_with?('book') || slug.start_with?('reference')
8-
@doc = at_css('#content')
8+
@doc = at_css('#content main')
99
elsif slug == 'error-index'
1010
css('.error-undescribed').remove
1111

@@ -30,7 +30,7 @@ def call
3030
css('.rusttest', '.test-arrow', 'hr').remove
3131

3232
css('a.header').each do |node|
33-
node.first_element_child['id'] = node['name']
33+
node.first_element_child['id'] = node['name'] || node['id']
3434
node.before(node.children).remove
3535
end
3636

@@ -62,6 +62,9 @@ def call
6262
node['data-language'] = 'rust' if node['class'] && node['class'].include?('rust')
6363
end
6464

65+
doc.first_element_child.name = 'h1' if doc.first_element_child.name = 'h2'
66+
at_css('h1').content = 'Rust Documentation' if root_page?
67+
6568
doc
6669
end
6770
end

lib/docs/scrapers/rust.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
module Docs
22
class Rust < UrlScraper
33
self.type = 'rust'
4-
self.release = '1.26.0'
4+
self.release = '1.28.0'
55
self.base_url = 'https://doc.rust-lang.org/'
6-
self.root_path = 'book/first-edition/index.html'
6+
self.root_path = 'book/second-edition/index.html'
77
self.initial_paths = %w(
88
reference/introduction.html
99
collections/index.html
@@ -17,13 +17,13 @@ class Rust < UrlScraper
1717
html_filters.push 'rust/entries', 'rust/clean_html'
1818

1919
options[:only_patterns] = [
20-
/\Abook\/first-edition\//,
20+
/\Abook\/second-edition\//,
2121
/\Areference\//,
2222
/\Acollections\//,
2323
/\Astd\// ]
2424

25-
options[:skip] = %w(book/first-edition/README.html)
26-
options[:skip_patterns] = [/(?<!\.html)\z/]
25+
options[:skip] = %w(book/second-edition/README.html)
26+
options[:skip_patterns] = [/(?<!\.html)\z/, /\/print\.html/]
2727

2828
options[:fix_urls] = ->(url) do
2929
url.sub! %r{(#{Rust.base_url}.+/)\z}, '\1index.html'

0 commit comments

Comments
 (0)