Update Rust to 1.48.0, fix 'notable trait' display
Unified · Split
| @@ -71,19 +71,6 @@ module Docs · 70 unmodified lines | ||
| 71 | 71 | doc.first_element_child.name = 'h1' if doc.first_element_child.name = 'h2' |
| 72 | 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 | 74 | css('code.content').each do |node| |
| 88 | 75 | node.name = 'pre' |
| 89 | 76 | node.css('.fmt-newline').each do |line| |
| @@ -97,6 +84,24 @@ module Docs · 7 unmodified lines | ||
| 97 | 84 | node.previous_element.before(node) |
| 98 | 85 | end |
| 99 | 86 | |
| 87 | + css('.sidebar').remove | |
| 88 | + | |
| 89 | + css('.collapse-toggle').remove | |
| 90 | + | |
| 91 | + # Fix how notable-traits sections are shown | |
| 92 | + | |
| 93 | + css('.method').each do |node| | |
| 94 | + traitSection = node.at_css('.notable-traits') | |
| 95 | + | |
| 96 | + if traitSection | |
| 97 | + traitSectionContent = traitSection.css('.notable-traits-tooltiptext') | |
| 98 | + traitSection.css('.notable-traits-tooltip').remove | |
| 99 | + traitSection.add_child(traitSectionContent) | |
| 100 | + node.after(traitSection) | |
| 101 | + end | |
| 102 | + | |
| 103 | + end | |
| 104 | + | |
| 100 | 105 | doc |
| 101 | 106 | end |
| 102 | 107 | end |
| @@ -1,9 +1,11 @@ | ||
| 1 | 1 | module Docs |
| 2 | 2 | class Rust |
| 3 | 3 | class EntriesFilter < Docs::EntriesFilter |
| 4 | + | |
| 4 | 5 | def get_name |
| 5 | 6 | if slug.start_with?('book') || slug.start_with?('reference') |
| 6 | − at_css("#sidebar a[href='#{File.basename(slug)}']").content | |
| 7 | + name = at_css("#sidebar a[href='#{File.basename(slug)}']") | |
| 8 | + name ? name.content : 'Introduction' | |
| 7 | 9 | elsif slug == 'error-index' |
| 8 | 10 | 'Compiler Errors' |
| 9 | 11 | else |
| @@ -51,6 +53,7 @@ module Docs · 41 unmodified lines | ||
| 51 | 53 | }.values |
| 52 | 54 | end |
| 53 | 55 | end |
| 56 | + | |
| 54 | 57 | end |
| 55 | 58 | end |
| 56 | 59 | end |
| @@ -3,12 +3,11 @@ · 2 unmodified lines | ||
| 3 | 3 | module Docs |
| 4 | 4 | class Rust < UrlScraper |
| 5 | 5 | self.type = 'rust' |
| 6 | − self.release = '1.47.0' | |
| 6 | + self.release = '1.48.0' | |
| 7 | 7 | self.base_url = 'https://doc.rust-lang.org/' |
| 8 | 8 | self.root_path = 'book/index.html' |
| 9 | 9 | self.initial_paths = %w( |
| 10 | 10 | reference/introduction.html |
| 11 | − collections/index.html | |
| 12 | 11 | std/index.html |
| 13 | 12 | error-index.html) |
| 14 | 13 | self.links = { |