Fix how 'notable trait' sections were displayed

- Fix error in reference/introduction.html while scraping
pull/1371/head
MasterEnoc 4 years ago
parent 4d3bae4aaa
commit 8e3b2cef64

@ -97,6 +97,22 @@ module Docs
node.previous_element.before(node) node.previous_element.before(node)
end end
css('.collapse-toggle').remove
# Fix how notable-traits sections are shown
css('.method').each do |node|
traitSection = node.at_css('.notable-traits')
if traitSection
traitSectionContent = traitSection.css('.notable-traits-tooltiptext')
traitSection.css('.notable-traits-tooltip').remove
traitSection.add_child(traitSectionContent)
node.after(traitSection)
end
end
doc doc
end end
end end

@ -1,9 +1,11 @@
module Docs module Docs
class Rust class Rust
class EntriesFilter < Docs::EntriesFilter class EntriesFilter < Docs::EntriesFilter
def get_name def get_name
if slug.start_with?('book') || slug.start_with?('reference') if slug.start_with?('book') || slug.start_with?('reference')
at_css("#sidebar a[href='#{File.basename(slug)}']").content name = at_css("#sidebar a[href='#{File.basename(slug)}']")
name ? name.content : 'Introduction'
elsif slug == 'error-index' elsif slug == 'error-index'
'Compiler Errors' 'Compiler Errors'
else else
@ -51,6 +53,7 @@ module Docs
}.values }.values
end end
end end
end end
end end
end end

Loading…
Cancel
Save