[devdocsgjs/main: 1280/1867] Fix how 'notable trait' sections were displayed
- From: Andy Holmes <andyholmes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [devdocsgjs/main: 1280/1867] Fix how 'notable trait' sections were displayed
- Date: Fri, 19 Nov 2021 23:47:52 +0000 (UTC)
commit 8e3b2cef64facae729daa4f33c3fd528cbf226dd
Author: MasterEnoc <brianhernandez222 hotmail com>
Date: Sat Nov 21 13:06:17 2020 -0600
Fix how 'notable trait' sections were displayed
- Fix error in reference/introduction.html while scraping
lib/docs/filters/rust/clean_html.rb | 16 ++++++++++++++++
lib/docs/filters/rust/entries.rb | 5 ++++-
2 files changed, 20 insertions(+), 1 deletion(-)
---
diff --git a/lib/docs/filters/rust/clean_html.rb b/lib/docs/filters/rust/clean_html.rb
index 55c55417..301e12f3 100644
--- a/lib/docs/filters/rust/clean_html.rb
+++ b/lib/docs/filters/rust/clean_html.rb
@@ -97,6 +97,22 @@ module Docs
node.previous_element.before(node)
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
end
end
diff --git a/lib/docs/filters/rust/entries.rb b/lib/docs/filters/rust/entries.rb
index 524342fc..2fa5186d 100644
--- a/lib/docs/filters/rust/entries.rb
+++ b/lib/docs/filters/rust/entries.rb
@@ -1,9 +1,11 @@
module Docs
class Rust
class EntriesFilter < Docs::EntriesFilter
+
def get_name
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'
'Compiler Errors'
else
@@ -51,6 +53,7 @@ module Docs
}.values
end
end
+
end
end
end
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]