History

Update Rust documentation (1.10.0)

Thibaut Courouble committed 10 years ago

Commit a83459b1 parent 922754a3 files · +17 −4Browse files

Unified · Split

3 files
  1. lib/docs/filters/rust/clean_html.rb +6 −2
  2. lib/docs/filters/rust/entries.rb +8 −0
  3. lib/docs/scrapers/rust.rb +3 −2
lib/docs/filters/rust/clean_html.rb+6−2
@@ -4,7 +4,7 @@ module Docs · 3 unmodified lines
4 def call4 def call
5 if slug.start_with?('book')5 if slug.start_with?('book')
6 book6 book
7 elsif slug.start_with?('reference')7 elsif slug.start_with?('reference') || slug == 'error-index'
8 reference8 reference
9 else9 else
10 api10 api
@@ -41,7 +41,11 @@ module Docs · 30 unmodified lines
41 end41 end
42 42
43 def reference43 def reference
44 css('#versioninfo').remove44 css('#versioninfo', '.error-undescribed').remove
45
46 css('.error-described').each do |node|
47 node.before(node.children).remove
48 end
45 end49 end
46 50
47 def api51 def api
lib/docs/filters/rust/entries.rb+8−0
@@ -6,6 +6,8 @@ module Docs · 5 unmodified lines
6 at_css("#toc a[href='#{File.basename(slug)}']").content6 at_css("#toc a[href='#{File.basename(slug)}']").content
7 elsif slug.start_with?('reference')7 elsif slug.start_with?('reference')
8 'Reference'8 'Reference'
9 elsif slug == 'error-index'
10 'Compiler Errors'
9 else11 else
10 name = at_css('h1.fqn .in-band').content.remove(/\A.+\s/)12 name = at_css('h1.fqn .in-band').content.remove(/\A.+\s/)
11 mod = slug.split('/').first13 mod = slug.split('/').first
@@ -21,6 +23,8 @@ module Docs · 9 unmodified lines
21 'Guide'23 'Guide'
22 elsif slug.start_with?('reference')24 elsif slug.start_with?('reference')
23 'Reference'25 'Reference'
26 elsif slug == 'error-index'
27 'Compiler Errors'
24 else28 else
25 path = name.split('::')29 path = name.split('::')
26 heading = at_css('h1.fqn .in-band').content.strip30 heading = at_css('h1.fqn .in-band').content.strip
@@ -43,6 +47,10 @@ module Docs · 16 unmodified lines
43 id = node['href'].remove('#')47 id = node['href'].remove('#')
44 [name, id]48 [name, id]
45 end49 end
50 elsif slug == 'error-index'
51 css('.error-described h2.section-header').map do |node|
52 [node.content, node['id']]
53 end
46 else54 else
47 css('#methods + * + div > .method', '#required-methods + div > .method', '#provided-methods + div > .method').map do |node|55 css('#methods + * + div > .method', '#required-methods + div > .method', '#provided-methods + div > .method').map do |node|
48 name = node.at_css('.fnname').content56 name = node.at_css('.fnname').content
lib/docs/scrapers/rust.rb+3−2
@@ -1,13 +1,14 @@
1module Docs1module Docs
2 class Rust < UrlScraper2 class Rust < UrlScraper
3 self.type = 'rust'3 self.type = 'rust'
4 self.release = '1.9.0'4 self.release = '1.10.0'
5 self.base_url = 'https://doc.rust-lang.org/'5 self.base_url = 'https://doc.rust-lang.org/'
6 self.root_path = 'book/index.html'6 self.root_path = 'book/index.html'
7 self.initial_paths = %w(7 self.initial_paths = %w(
8 reference.html8 reference.html
9 collections/index.html9 collections/index.html
10 std/index.html)10 std/index.html
11 error-index.html)
11 self.links = {12 self.links = {
12 home: 'https://www.rust-lang.org/',13 home: 'https://www.rust-lang.org/',
13 code: 'https://github.com/rust-lang/rust'14 code: 'https://github.com/rust-lang/rust'