- Fix error in reference/introduction.html while scraping
Unified · Split
| @@ -97,6 +97,22 @@ module Docs · 96 unmodified lines | |||
| 97 | node.previous_element.before(node) | 97 | node.previous_element.before(node) |
| 98 | end | 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 | doc | 116 | doc |
| 101 | end | 117 | end |
| 102 | end | 118 | end |
| @@ -1,9 +1,11 @@ | |||
| 1 | module Docs | 1 | module Docs |
| 2 | class Rust | 2 | class Rust |
| 3 | class EntriesFilter < Docs::EntriesFilter | 3 | class EntriesFilter < Docs::EntriesFilter |
| 4 | |||
| 4 | def get_name | 5 | def get_name |
| 5 | if slug.start_with?('book') || slug.start_with?('reference') | 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 | elsif slug == 'error-index' | 9 | elsif slug == 'error-index' |
| 8 | 'Compiler Errors' | 10 | 'Compiler Errors' |
| 9 | else | 11 | else |
| @@ -51,6 +53,7 @@ module Docs · 41 unmodified lines | |||
| 51 | }.values | 53 | }.values |
| 52 | end | 54 | end |
| 53 | end | 55 | end |
| 56 | |||
| 54 | end | 57 | end |
| 55 | end | 58 | end |
| 56 | end | 59 | end |