History

Update Rust to 1.48.0 and improve clean_html filter

MasterEnoc committed 5 years ago

Commit c5f7de61 parent 8e3b2ce2 files · +3 −15Browse files

Unified · Split

2 files
  1. lib/docs/filters/rust/clean_html.rb +2 −13
  2. lib/docs/scrapers/rust.rb +1 −2
lib/docs/filters/rust/clean_html.rb+2−13
@@ -71,19 +71,6 @@ module Docs · 70 unmodified lines
71 doc.first_element_child.name = 'h1' if doc.first_element_child.name = 'h2'71 doc.first_element_child.name = 'h1' if doc.first_element_child.name = 'h2'
72 at_css('h1').content = 'Rust Documentation' if root_page?72 at_css('h1').content = 'Rust Documentation' if root_page?
73 73
74 css('.table-display').each do |node|
75 node.css('td').each do |td|
76 node.before(td.children)
77 end
78 node.remove
79 end
80
81 css('.important-traits').to_a.each_with_index do |node, index|
82 content = node.at_css('.content.hidden .content')
83 node.at_css('.content.hidden').replace(content) if content
84 node.parent.after(node) if node.parent.name.in?(%(h2 h3 h4))
85 end
86
87 css('code.content').each do |node|74 css('code.content').each do |node|
88 node.name = 'pre'75 node.name = 'pre'
89 node.css('.fmt-newline').each do |line|76 node.css('.fmt-newline').each do |line|
@@ -97,6 +84,8 @@ module Docs · 7 unmodified lines
97 node.previous_element.before(node)84 node.previous_element.before(node)
98 end85 end
99 86
87 css('.sidebar').remove
88
100 css('.collapse-toggle').remove89 css('.collapse-toggle').remove
101 90
102 # Fix how notable-traits sections are shown91 # Fix how notable-traits sections are shown
lib/docs/scrapers/rust.rb+1−2
@@ -3,12 +3,11 @@ · 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.47.0'6 self.release = '1.48.0'
7 self.base_url = 'https://doc.rust-lang.org/'7 self.base_url = 'https://doc.rust-lang.org/'
8 self.root_path = 'book/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.html
12 std/index.html11 std/index.html
13 error-index.html)12 error-index.html)
14 self.links = {13 self.links = {