- Fix error in reference/introduction.html while scraping
Unified · Split
| @@ -97,6 +97,22 @@ module Docs · 96 unmodified lines | ||
| 97 | 97 | node.previous_element.before(node) |
| 98 | 98 | end |
| 99 | 99 | |
| 100 | + css('.collapse-toggle').remove | |
| 101 | + | |
| 102 | + # Fix how notable-traits sections are shown | |
| 103 | + | |
| 104 | + css('.method').each do |node| | |
| 105 | + traitSection = node.at_css('.notable-traits') | |
| 106 | + | |
| 107 | + if traitSection | |
| 108 | + traitSectionContent = traitSection.css('.notable-traits-tooltiptext') | |
| 109 | + traitSection.css('.notable-traits-tooltip').remove | |
| 110 | + traitSection.add_child(traitSectionContent) | |
| 111 | + node.after(traitSection) | |
| 112 | + end | |
| 113 | + | |
| 114 | + end | |
| 115 | + | |
| 100 | 116 | doc |
| 101 | 117 | end |
| 102 | 118 | 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 |