rustdoc: clean up CSS for All Items and All Crates lists
This reduces the amount of CSS, and makes these two pages more consistent (which, necessarily, means changing them a bit).
This commit is contained in:
parent
54f20bbb8a
commit
b72de9be74
@ -294,16 +294,15 @@ impl AllTypes {
|
|||||||
|
|
||||||
impl AllTypes {
|
impl AllTypes {
|
||||||
fn print(self, f: &mut Buffer) {
|
fn print(self, f: &mut Buffer) {
|
||||||
fn print_entries(f: &mut Buffer, e: &FxHashSet<ItemEntry>, title: &str, class: &str) {
|
fn print_entries(f: &mut Buffer, e: &FxHashSet<ItemEntry>, title: &str) {
|
||||||
if !e.is_empty() {
|
if !e.is_empty() {
|
||||||
let mut e: Vec<&ItemEntry> = e.iter().collect();
|
let mut e: Vec<&ItemEntry> = e.iter().collect();
|
||||||
e.sort();
|
e.sort();
|
||||||
write!(
|
write!(
|
||||||
f,
|
f,
|
||||||
"<h3 id=\"{}\">{}</h3><ul class=\"{} docblock\">",
|
"<h3 id=\"{}\">{}</h3><ul class=\"all-items\">",
|
||||||
title.replace(' ', "-"), // IDs cannot contain whitespaces.
|
title.replace(' ', "-"), // IDs cannot contain whitespaces.
|
||||||
title,
|
title
|
||||||
class
|
|
||||||
);
|
);
|
||||||
|
|
||||||
for s in e.iter() {
|
for s in e.iter() {
|
||||||
@ -321,20 +320,20 @@ impl AllTypes {
|
|||||||
);
|
);
|
||||||
// Note: print_entries does not escape the title, because we know the current set of titles
|
// Note: print_entries does not escape the title, because we know the current set of titles
|
||||||
// doesn't require escaping.
|
// doesn't require escaping.
|
||||||
print_entries(f, &self.structs, "Structs", "structs");
|
print_entries(f, &self.structs, "Structs");
|
||||||
print_entries(f, &self.enums, "Enums", "enums");
|
print_entries(f, &self.enums, "Enums");
|
||||||
print_entries(f, &self.unions, "Unions", "unions");
|
print_entries(f, &self.unions, "Unions");
|
||||||
print_entries(f, &self.primitives, "Primitives", "primitives");
|
print_entries(f, &self.primitives, "Primitives");
|
||||||
print_entries(f, &self.traits, "Traits", "traits");
|
print_entries(f, &self.traits, "Traits");
|
||||||
print_entries(f, &self.macros, "Macros", "macros");
|
print_entries(f, &self.macros, "Macros");
|
||||||
print_entries(f, &self.attributes, "Attribute Macros", "attributes");
|
print_entries(f, &self.attributes, "Attribute Macros");
|
||||||
print_entries(f, &self.derives, "Derive Macros", "derives");
|
print_entries(f, &self.derives, "Derive Macros");
|
||||||
print_entries(f, &self.functions, "Functions", "functions");
|
print_entries(f, &self.functions, "Functions");
|
||||||
print_entries(f, &self.typedefs, "Typedefs", "typedefs");
|
print_entries(f, &self.typedefs, "Typedefs");
|
||||||
print_entries(f, &self.trait_aliases, "Trait Aliases", "trait-aliases");
|
print_entries(f, &self.trait_aliases, "Trait Aliases");
|
||||||
print_entries(f, &self.opaque_tys, "Opaque Types", "opaque-types");
|
print_entries(f, &self.opaque_tys, "Opaque Types");
|
||||||
print_entries(f, &self.statics, "Statics", "statics");
|
print_entries(f, &self.statics, "Statics");
|
||||||
print_entries(f, &self.constants, "Constants", "constants")
|
print_entries(f, &self.constants, "Constants");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -519,12 +519,12 @@ if (typeof exports !== 'undefined') {exports.searchIndex = searchIndex};
|
|||||||
let content = format!(
|
let content = format!(
|
||||||
"<h1 class=\"fqn\">\
|
"<h1 class=\"fqn\">\
|
||||||
<span class=\"in-band\">List of all crates</span>\
|
<span class=\"in-band\">List of all crates</span>\
|
||||||
</h1><ul class=\"crate mod\">{}</ul>",
|
</h1><ul class=\"all-items\">{}</ul>",
|
||||||
krates
|
krates
|
||||||
.iter()
|
.iter()
|
||||||
.map(|s| {
|
.map(|s| {
|
||||||
format!(
|
format!(
|
||||||
"<li><a class=\"crate mod\" href=\"{}index.html\">{}</a></li>",
|
"<li><a href=\"{}index.html\">{}</a></li>",
|
||||||
ensure_trailing_slash(s),
|
ensure_trailing_slash(s),
|
||||||
s
|
s
|
||||||
)
|
)
|
||||||
|
@ -207,7 +207,6 @@ a.source,
|
|||||||
.out-of-band,
|
.out-of-band,
|
||||||
span.since,
|
span.since,
|
||||||
details.rustdoc-toggle > summary::before,
|
details.rustdoc-toggle > summary::before,
|
||||||
.content ul.crate a.crate,
|
|
||||||
a.srclink,
|
a.srclink,
|
||||||
#help-button > button,
|
#help-button > button,
|
||||||
details.rustdoc-toggle.top-doc > summary,
|
details.rustdoc-toggle.top-doc > summary,
|
||||||
@ -218,7 +217,7 @@ details.rustdoc-toggle.non-exhaustive > summary::before,
|
|||||||
.more-examples-toggle summary, .more-examples-toggle .hide-more,
|
.more-examples-toggle summary, .more-examples-toggle .hide-more,
|
||||||
.example-links a,
|
.example-links a,
|
||||||
/* This selector is for the items listed in the "all items" page. */
|
/* This selector is for the items listed in the "all items" page. */
|
||||||
#main-content > ul.docblock > li > a {
|
ul.all-items {
|
||||||
font-family: "Fira Sans", Arial, NanumBarunGothic, sans-serif;
|
font-family: "Fira Sans", Arial, NanumBarunGothic, sans-serif;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -788,6 +787,7 @@ h2.small-section-header > .anchor {
|
|||||||
content: '§';
|
content: '§';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.all-items a:hover,
|
||||||
.docblock a:not(.srclink):not(.test-arrow):not(.scrape-help):hover,
|
.docblock a:not(.srclink):not(.test-arrow):not(.scrape-help):hover,
|
||||||
.docblock-short a:not(.srclink):not(.test-arrow):not(.scrape-help):hover, .item-info a {
|
.docblock-short a:not(.srclink):not(.test-arrow):not(.scrape-help):hover, .item-info a {
|
||||||
text-decoration: underline;
|
text-decoration: underline;
|
||||||
@ -1517,10 +1517,7 @@ kbd {
|
|||||||
cursor: default;
|
cursor: default;
|
||||||
}
|
}
|
||||||
|
|
||||||
#main-content > ul {
|
ul.all-items > li {
|
||||||
padding-left: 10px;
|
|
||||||
}
|
|
||||||
#main-content > ul > li {
|
|
||||||
list-style: none;
|
list-style: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user