Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add method-toggle to <details> for methods #85169

Merged
merged 1 commit into from
May 20, 2021
Merged

Conversation

jsha
Copy link
Contributor

@jsha jsha commented May 11, 2021

The makes the code for handling "auto-hide" settings more consistent.

Demo at https://hoffman-andrews.com/rust/hoist-classes/std/string/struct.String.html

Fixes #84829

@rust-highfive
Copy link
Collaborator

Some changes occurred in HTML/CSS/JS.

cc @GuillaumeGomez

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 11, 2021
@rust-log-analyzer

This comment has been minimized.

@jsha jsha mentioned this pull request May 11, 2021
@GuillaumeGomez
Copy link
Member

Looks good to me! Just need to update the test failure and it's good to go.

Comment on lines 1353 to 1359
let method_toggle_class =
if item_type == ItemType::Method { " method-toggle" } else { "" };
write!(
w,
"<details class=\"rustdoc-toggle{}\" open><summary class=\"{}{}\">",
method_toggle_class, item_type, in_trait_class
);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better move space from " method-toggle" into format string?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No because then we might have an unwanted extra whitespace in case it's not a method.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

js\html minificator remove extra spaces, isn't it?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no html minifier.

@bors
Copy link
Contributor

bors commented May 12, 2021

☔ The latest upstream changes (presumably #85199) made this pull request unmergeable. Please resolve the merge conflicts.

@jsha
Copy link
Contributor Author

jsha commented May 12, 2021

Started work on fixing the XPath tests. I can't really fix them properly until #85167 is fixed, because that one actually involves improper nesting of the HTML. In order to fix the XPath tests reasonably for this change I need the <h4>'s to be descendants of their corresponding <summary>.

@jsha
Copy link
Contributor Author

jsha commented May 19, 2021

I realized the XPath tests were telling me about a real problem: When there's no documentation on a method, we don't wrap it in <details><summary>. That means there's no place to put the classes. Therefore I think the approach of moving classes on to the summaries won't work. However, I'll preserve the part of this change that adds method-toggle to methods.

The makes the code for handling "auto-hide" settings more consistent.
@jsha jsha changed the title Move method (etc) classes onto summaries. Add method-toggle to <details> for methods May 19, 2021
@GuillaumeGomez
Copy link
Member

I see, it's unfortunate but it makes sense. Well, that's already an improvement so let's go forward with it! Thanks!

@bors: r+ rollup

@bors
Copy link
Contributor

bors commented May 19, 2021

📌 Commit 24480de has been approved by GuillaumeGomez

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 19, 2021
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request May 19, 2021
Add method-toggle to <details> for methods

The makes the code for handling "auto-hide" settings more consistent.

Demo at https://hoffman-andrews.com/rust/hoist-classes/std/string/struct.String.html

Fixes rust-lang#84829
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request May 19, 2021
Add method-toggle to <details> for methods

The makes the code for handling "auto-hide" settings more consistent.

Demo at https://hoffman-andrews.com/rust/hoist-classes/std/string/struct.String.html

Fixes rust-lang#84829
bors added a commit to rust-lang-ci/rust that referenced this pull request May 20, 2021
Rollup of 8 pull requests

Successful merges:

 - rust-lang#84717 (impl FromStr for proc_macro::Literal)
 - rust-lang#85169 (Add method-toggle to <details> for methods)
 - rust-lang#85287 (Expose `Concurrent` (private type in public i'face))
 - rust-lang#85315 (adding time complexity for partition_in_place iter method)
 - rust-lang#85439 (Add diagnostic item to `CStr`)
 - rust-lang#85464 (Fix UB in documented example for `ptr::swap`)
 - rust-lang#85470 (Fix invalid CSS rules for a:hover)
 - rust-lang#85472 (CTFE Machine: do not expose Allocation)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 4217430 into rust-lang:master May 20, 2021
@rustbot rustbot added this to the 1.54.0 milestone May 20, 2021
@jsha jsha deleted the hoist-classes branch May 20, 2021 15:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Move header CSS classes (such as "method"/"function"/etc) from h3/h4 into their parent
7 participants