Add method-toggle to <details> for methods.
The makes the code for handling "auto-hide" settings more consistent.
This commit is contained in:
parent
491cf5561e
commit
24480ded58
2 changed files with 10 additions and 15 deletions
|
@ -1352,8 +1352,11 @@ fn render_impl(
|
|||
}
|
||||
let w = if short_documented && trait_.is_some() { interesting } else { boring };
|
||||
|
||||
if !doc_buffer.is_empty() {
|
||||
w.write_str("<details class=\"rustdoc-toggle\" open><summary>");
|
||||
let toggled = !doc_buffer.is_empty();
|
||||
if toggled {
|
||||
let method_toggle_class =
|
||||
if item_type == ItemType::Method { " method-toggle" } else { "" };
|
||||
write!(w, "<details class=\"rustdoc-toggle{}\" open><summary>", method_toggle_class);
|
||||
}
|
||||
match *item.kind {
|
||||
clean::MethodItem(..) | clean::TyMethodItem(_) => {
|
||||
|
@ -1453,7 +1456,7 @@ fn render_impl(
|
|||
}
|
||||
|
||||
w.push_buffer(info_buffer);
|
||||
if !doc_buffer.is_empty() {
|
||||
if toggled {
|
||||
w.write_str("</summary>");
|
||||
w.push_buffer(doc_buffer);
|
||||
w.push_str("</details>");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue