Rollup merge of #102447 - notriddle:notriddle/method-toggle, r=jsha
rustdoc: add method spacing to trait methods
More cleanup for 8846c0853d
, this time in trait layouts when things are collapsed.
This PR makes two changes to the appearance of trait pages:
* It adds the `method-toggle` class to method toggles on traits, making the DOM more consistent with type pages (which already have this class).
## Before

## After

* It adds a bottom margin to docblocks nested directly in the implementors list, giving it a similar appearance to if it was nested within a toggle.
## Before

## After

This commit is contained in:
commit
8a73397a62
3 changed files with 9 additions and 8 deletions
|
@ -716,7 +716,7 @@ fn item_trait(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, t: &clean:
|
|||
document(&mut content, cx, m, Some(t), HeadingOffset::H5);
|
||||
let toggled = !content.is_empty();
|
||||
if toggled {
|
||||
write!(w, "<details class=\"rustdoc-toggle\" open><summary>");
|
||||
write!(w, "<details class=\"rustdoc-toggle method-toggle\" open><summary>");
|
||||
}
|
||||
write!(w, "<div id=\"{}\" class=\"method has-srclink\">", id);
|
||||
render_rightside(w, cx, m, t, RenderMode::Normal);
|
||||
|
|
|
@ -2014,7 +2014,8 @@ in storage.js plus the media query with (min-width: 701px)
|
|||
|
||||
.method-toggle summary,
|
||||
.implementors-toggle summary,
|
||||
.impl {
|
||||
.impl,
|
||||
#implementors-list > .docblock {
|
||||
margin-bottom: 0.75em;
|
||||
}
|
||||
|
||||
|
|
|
@ -4,12 +4,12 @@
|
|||
// summary. Trait methods with no documentation should not be wrapped.
|
||||
//
|
||||
// @has foo/trait.Foo.html
|
||||
// @has - '//details[@class="rustdoc-toggle"]//summary//h4[@class="code-header"]' 'is_documented()'
|
||||
// @!has - '//details[@class="rustdoc-toggle"]//summary//h4[@class="code-header"]' 'not_documented()'
|
||||
// @has - '//details[@class="rustdoc-toggle"]//*[@class="docblock"]' 'is_documented is documented'
|
||||
// @has - '//details[@class="rustdoc-toggle"]//summary//h4[@class="code-header"]' 'is_documented_optional()'
|
||||
// @!has - '//details[@class="rustdoc-toggle"]//summary//h4[@class="code-header"]' 'not_documented_optional()'
|
||||
// @has - '//details[@class="rustdoc-toggle"]//*[@class="docblock"]' 'is_documented_optional is documented'
|
||||
// @has - '//details[@class="rustdoc-toggle method-toggle"]//summary//h4[@class="code-header"]' 'is_documented()'
|
||||
// @!has - '//details[@class="rustdoc-toggle method-toggle"]//summary//h4[@class="code-header"]' 'not_documented()'
|
||||
// @has - '//details[@class="rustdoc-toggle method-toggle"]//*[@class="docblock"]' 'is_documented is documented'
|
||||
// @has - '//details[@class="rustdoc-toggle method-toggle"]//summary//h4[@class="code-header"]' 'is_documented_optional()'
|
||||
// @!has - '//details[@class="rustdoc-toggle method-toggle"]//summary//h4[@class="code-header"]' 'not_documented_optional()'
|
||||
// @has - '//details[@class="rustdoc-toggle method-toggle"]//*[@class="docblock"]' 'is_documented_optional is documented'
|
||||
pub trait Foo {
|
||||
fn not_documented();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue