1
Fork 0

Add css classes

This commit is contained in:
Manish Goregaokar 2021-03-27 18:09:31 -07:00
parent def144c2e7
commit 8e9882dbc4
3 changed files with 12 additions and 12 deletions

View file

@ -1030,7 +1030,7 @@ fn render_attributes_in_pre(w: &mut Buffer, it: &clean::Item, prefix: &str) {
// a div to produce a newline after it. // a div to produce a newline after it.
fn render_attributes_in_code(w: &mut Buffer, it: &clean::Item) { fn render_attributes_in_code(w: &mut Buffer, it: &clean::Item) {
for a in attributes(it) { for a in attributes(it) {
write!(w, "<div>{}</div>", a); write!(w, "<div class=\"code-attribute\">{}</div>", a);
} }
} }

View file

@ -140,7 +140,7 @@ fn should_hide_fields(n_fields: usize) -> bool {
fn toggle_open(w: &mut Buffer, text: &str) { fn toggle_open(w: &mut Buffer, text: &str) {
write!( write!(
w, w,
"<details class=\"type-contents-toggle\"><summary class=\"hideme\"><span>Show {}</span></summary>", "<details class=\"rustdoc-toggle type-contents-toggle\"><summary class=\"hideme\"><span>Show {}</span></summary>",
text text
); );
} }

View file

@ -1756,20 +1756,20 @@ div.name.expand::before {
/* The hideme class is used on summary tags that contain a span with /* The hideme class is used on summary tags that contain a span with
placeholder text shown only when the toggle is closed. For instance, placeholder text shown only when the toggle is closed. For instance,
"Expand description" or "Show methods". */ "Expand description" or "Show methods". */
details > summary.hideme { details.rustdoc-toggle > summary.hideme {
cursor: pointer; cursor: pointer;
} }
details > summary::-webkit-details-marker { details.rustdoc-toggle > summary::-webkit-details-marker {
display: none; display: none;
} }
details > summary.hideme > span { details.rustdoc-toggle > summary.hideme > span {
margin-left: 9px; margin-left: 9px;
color: #999; color: #999;
} }
details > summary::before { details.rustdoc-toggle > summary::before {
content: "[+]"; content: "[+]";
font-weight: 300; font-weight: 300;
font-size: 0.8em; font-size: 0.8em;
@ -1777,11 +1777,11 @@ details > summary::before {
letter-spacing: 1px; letter-spacing: 1px;
} }
details > summary.hideme::before { details.rustdoc-toggle > summary.hideme::before {
position: relative; position: relative;
} }
details > summary:not(.hideme)::before { details.rustdoc-toggle > summary:not(.hideme)::before {
float: left; float: left;
} }
@ -1790,19 +1790,19 @@ details > summary:not(.hideme)::before {
affect the layout of the items to its right. To do that, we use affect the layout of the items to its right. To do that, we use
absolute positioning. Note that we also set position: relative absolute positioning. Note that we also set position: relative
on the parent <details> to make this work properly. */ on the parent <details> to make this work properly. */
details[open] > summary.hideme { details.rustdoc-toggle[open] > summary.hideme {
position: absolute; position: absolute;
} }
details[open] { details.rustdoc-toggle[open] {
position: relative; position: relative;
} }
details[open] > summary.hideme > span { details.rustdoc-toggle[open] > summary.hideme > span {
display: none; display: none;
} }
details[open] > summary::before { details.rustdoc-toggle[open] > summary::before {
content: "[]"; content: "[]";
display: inline; display: inline;
} }