Auto merge of #84703 - GuillaumeGomez:cleanup-dom, r=jsha
Clean up dom The commits come from #84480. They were errors reported by the `tidy` script that we will use to ensure that the HTML generated by rustdoc is valid. I checked carefully that there were no difference so in principle it should be exactly the same rendering but a double-check would be very appreciated in case I missed something. Extra note: `<h4>` and some `<h3>` tags were replaced by `<div>` because they're not supposed to contain tags as they currently do. r? `@jsha`
This commit is contained in:
commit
da865095cf
61 changed files with 256 additions and 241 deletions
|
|
@ -235,6 +235,7 @@ crate fn redirect(url: &str) -> String {
|
|||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="refresh" content="0;URL={url}">
|
||||
<title>Redirection</title>
|
||||
</head>
|
||||
<body>
|
||||
<p>Redirecting to <a href="{url}">{url}</a>...</p>
|
||||
|
|
|
|||
|
|
@ -1369,7 +1369,11 @@ fn render_impl(
|
|||
})
|
||||
})
|
||||
.map(|item| format!("{}.{}", item.type_(), name));
|
||||
write!(w, "<h4 id=\"{}\" class=\"{}{}\">", id, item_type, in_trait_class,);
|
||||
write!(
|
||||
w,
|
||||
"<div id=\"{}\" class=\"{}{} has-srclink\">",
|
||||
id, item_type, in_trait_class,
|
||||
);
|
||||
w.write_str("<code>");
|
||||
render_assoc_item(
|
||||
w,
|
||||
|
|
@ -1388,13 +1392,17 @@ fn render_impl(
|
|||
);
|
||||
write!(w, "<a href=\"#{}\" class=\"anchor\"></a>", id);
|
||||
write_srclink(cx, item, w);
|
||||
w.write_str("</h4>");
|
||||
w.write_str("</div>");
|
||||
}
|
||||
}
|
||||
clean::TypedefItem(ref tydef, _) => {
|
||||
let source_id = format!("{}.{}", ItemType::AssocType, name);
|
||||
let id = cx.derive_id(source_id.clone());
|
||||
write!(w, "<h4 id=\"{}\" class=\"{}{}\"><code>", id, item_type, in_trait_class);
|
||||
write!(
|
||||
w,
|
||||
"<div id=\"{}\" class=\"{}{} has-srclink\"><code>",
|
||||
id, item_type, in_trait_class
|
||||
);
|
||||
assoc_type(
|
||||
w,
|
||||
item,
|
||||
|
|
@ -1406,12 +1414,16 @@ fn render_impl(
|
|||
);
|
||||
w.write_str("</code>");
|
||||
write!(w, "<a href=\"#{}\" class=\"anchor\"></a>", id);
|
||||
w.write_str("</h4>");
|
||||
w.write_str("</div>");
|
||||
}
|
||||
clean::AssocConstItem(ref ty, ref default) => {
|
||||
let source_id = format!("{}.{}", item_type, name);
|
||||
let id = cx.derive_id(source_id.clone());
|
||||
write!(w, "<h4 id=\"{}\" class=\"{}{}\"><code>", id, item_type, in_trait_class);
|
||||
write!(
|
||||
w,
|
||||
"<div id=\"{}\" class=\"{}{} has-srclink\"><code>",
|
||||
id, item_type, in_trait_class
|
||||
);
|
||||
assoc_const(
|
||||
w,
|
||||
item,
|
||||
|
|
@ -1431,12 +1443,12 @@ fn render_impl(
|
|||
);
|
||||
write!(w, "<a href=\"#{}\" class=\"anchor\"></a>", id);
|
||||
write_srclink(cx, item, w);
|
||||
w.write_str("</h4>");
|
||||
w.write_str("</div>");
|
||||
}
|
||||
clean::AssocTypeItem(ref bounds, ref default) => {
|
||||
let source_id = format!("{}.{}", item_type, name);
|
||||
let id = cx.derive_id(source_id.clone());
|
||||
write!(w, "<h4 id=\"{}\" class=\"{}{}\"><code>", id, item_type, in_trait_class);
|
||||
write!(w, "<div id=\"{}\" class=\"{}{}\"><code>", id, item_type, in_trait_class,);
|
||||
assoc_type(
|
||||
w,
|
||||
item,
|
||||
|
|
@ -1448,7 +1460,7 @@ fn render_impl(
|
|||
);
|
||||
w.write_str("</code>");
|
||||
write!(w, "<a href=\"#{}\" class=\"anchor\"></a>", id);
|
||||
w.write_str("</h4>");
|
||||
w.write_str("</div>");
|
||||
}
|
||||
clean::StrippedItem(..) => return,
|
||||
_ => panic!("can't make docs for trait item with name {:?}", item.name),
|
||||
|
|
@ -1577,7 +1589,8 @@ fn render_impl(
|
|||
if let Some(use_absolute) = use_absolute {
|
||||
write!(
|
||||
w,
|
||||
"{}<h3 id=\"{}\" class=\"impl\"{}><code class=\"in-band\">",
|
||||
"{}<div id=\"{}\" class=\"impl has-srclink\"{}>\
|
||||
<code class=\"in-band\">",
|
||||
open_details(&mut close_tags, is_implementing_trait),
|
||||
id,
|
||||
aliases
|
||||
|
|
@ -1604,7 +1617,8 @@ fn render_impl(
|
|||
} else {
|
||||
write!(
|
||||
w,
|
||||
"{}<h3 id=\"{}\" class=\"impl\"{}><code class=\"in-band\">{}</code>",
|
||||
"{}<div id=\"{}\" class=\"impl has-srclink\"{}>\
|
||||
<code class=\"in-band\">{}</code>",
|
||||
open_details(&mut close_tags, is_implementing_trait),
|
||||
id,
|
||||
aliases,
|
||||
|
|
@ -1621,9 +1635,9 @@ fn render_impl(
|
|||
);
|
||||
write_srclink(cx, &i.impl_item, w);
|
||||
if !toggled {
|
||||
w.write_str("</h3>");
|
||||
w.write_str("</div>");
|
||||
} else {
|
||||
w.write_str("</h3></summary>");
|
||||
w.write_str("</div></summary>");
|
||||
}
|
||||
|
||||
if trait_.is_some() {
|
||||
|
|
@ -1649,10 +1663,12 @@ fn render_impl(
|
|||
);
|
||||
}
|
||||
}
|
||||
w.write_str("<div class=\"impl-items\">");
|
||||
w.push_buffer(default_impl_items);
|
||||
w.push_buffer(impl_items);
|
||||
close_tags.insert_str(0, "</div>");
|
||||
if !default_impl_items.is_empty() || !impl_items.is_empty() {
|
||||
w.write_str("<div class=\"impl-items\">");
|
||||
w.push_buffer(default_impl_items);
|
||||
w.push_buffer(impl_items);
|
||||
close_tags.insert_str(0, "</div>");
|
||||
}
|
||||
w.write_str(&close_tags);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ pub(super) fn print_item(cx: &Context<'_>, item: &clean::Item, buf: &mut Buffer,
|
|||
);
|
||||
}
|
||||
}
|
||||
write!(buf, "<a class=\"{}\" href=\"\">{}</a>", item.type_(), item.name.as_ref().unwrap());
|
||||
write!(buf, "<a class=\"{}\" href=\"#\">{}</a>", item.type_(), item.name.as_ref().unwrap());
|
||||
write!(
|
||||
buf,
|
||||
"<button id=\"copy-path\" onclick=\"copy_path(this)\">\
|
||||
|
|
@ -585,12 +585,12 @@ fn item_trait(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, t: &clean::Tra
|
|||
if toggled {
|
||||
write!(w, "<details class=\"rustdoc-toggle\" open><summary>");
|
||||
}
|
||||
write!(w, "<h3 id=\"{id}\" class=\"method\"><code>", id = id);
|
||||
write!(w, "<div id=\"{}\" class=\"method has-srclink\"><code>", id);
|
||||
render_assoc_item(w, m, AssocItemLink::Anchor(Some(&id)), ItemType::Impl, cx);
|
||||
w.write_str("</code>");
|
||||
render_stability_since(w, m, t, cx.tcx());
|
||||
write_srclink(cx, m, w);
|
||||
w.write_str("</h3>");
|
||||
w.write_str("</div>");
|
||||
if toggled {
|
||||
write!(w, "</summary>");
|
||||
w.push_buffer(content);
|
||||
|
|
|
|||
|
|
@ -117,8 +117,7 @@ h2 {
|
|||
h3 {
|
||||
font-size: 1.3em;
|
||||
}
|
||||
h1, h2, h3:not(.impl):not(.method):not(.type):not(.tymethod):not(.notable),
|
||||
h4:not(.method):not(.type):not(.tymethod):not(.associatedconstant):not(.associatedtype) {
|
||||
h1, h2, h3, h4 {
|
||||
font-weight: 500;
|
||||
margin: 20px 0 15px 0;
|
||||
padding-bottom: 6px;
|
||||
|
|
@ -135,30 +134,38 @@ h1.fqn {
|
|||
h1.fqn > .in-band > a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
h2, h3:not(.impl):not(.method):not(.type):not(.tymethod),
|
||||
h4:not(.method):not(.type):not(.tymethod):not(.associatedconstant):not(.associatedtype) {
|
||||
h2, h3, h4 {
|
||||
border-bottom: 1px solid;
|
||||
}
|
||||
h3.impl, h3.method, h4.method, h3.type, h4.type, h4.associatedconstant, h4.associatedtype {
|
||||
.impl, .method,
|
||||
.type, .associatedconstant,
|
||||
.associatedtype {
|
||||
flex-basis: 100%;
|
||||
font-weight: 600;
|
||||
margin-top: 16px;
|
||||
margin-bottom: 10px;
|
||||
position: relative;
|
||||
}
|
||||
h3.impl, h3.method, h4.method.trait-impl, h3.type,
|
||||
h4.type.trait-impl, h4.associatedconstant.trait-impl, h4.associatedtype.trait-impl {
|
||||
.impl, .method.trait-impl,
|
||||
.type.trait-impl,
|
||||
.associatedconstant.trait-impl,
|
||||
.associatedtype.trait-impl {
|
||||
padding-left: 15px;
|
||||
}
|
||||
|
||||
div.impl-items > div {
|
||||
padding-left: 0;
|
||||
}
|
||||
|
||||
h1, h2, h3, h4,
|
||||
.sidebar, a.source, .search-input, .search-results .result-name,
|
||||
.content table td:first-child > a,
|
||||
div.item-list .out-of-band,
|
||||
div.item-list .out-of-band, span.since,
|
||||
#source-sidebar, #sidebar-toggle,
|
||||
details.rustdoc-toggle > summary::before,
|
||||
details.undocumented > summary::before,
|
||||
.content ul.crate a.crate,
|
||||
div.impl-items > div:not(.docblock):not(.item-info),
|
||||
.content ul.crate a.crate, a.srclink,
|
||||
/* This selector is for the items listed in the "all items" page. */
|
||||
#main > ul.docblock > li > a {
|
||||
font-family: "Fira Sans", Arial, sans-serif;
|
||||
|
|
@ -313,8 +320,6 @@ nav.sub {
|
|||
margin-bottom: 14px;
|
||||
}
|
||||
.block h2, .block h3 {
|
||||
margin-top: 0;
|
||||
margin-bottom: 8px;
|
||||
text-align: center;
|
||||
}
|
||||
.block ul, .block li {
|
||||
|
|
@ -462,15 +467,7 @@ nav.sub {
|
|||
font-weight: normal;
|
||||
}
|
||||
|
||||
h3.impl > .out-of-band {
|
||||
font-size: 21px;
|
||||
}
|
||||
|
||||
h4.method > .out-of-band {
|
||||
font-size: 19px;
|
||||
}
|
||||
|
||||
h4 > code, h3 > code, .invisible > code {
|
||||
.method > code, .trait-impl > code, .invisible > code {
|
||||
max-width: calc(100% - 41px);
|
||||
display: block;
|
||||
}
|
||||
|
|
@ -543,7 +540,7 @@ h4 > code, h3 > code, .invisible > code {
|
|||
}
|
||||
.content .multi-column li { width: 100%; display: inline-block; }
|
||||
|
||||
.content .method {
|
||||
.content > .methods > .method {
|
||||
font-size: 1em;
|
||||
position: relative;
|
||||
}
|
||||
|
|
@ -555,7 +552,7 @@ h4 > code, h3 > code, .invisible > code {
|
|||
font-size: 0.8em;
|
||||
}
|
||||
|
||||
.content .methods > div:not(.notable-traits):not(.methods) {
|
||||
.content .methods > div:not(.notable-traits):not(.method) {
|
||||
margin-left: 40px;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
|
@ -564,9 +561,6 @@ h4 > code, h3 > code, .invisible > code {
|
|||
margin-left: 20px;
|
||||
margin-top: -34px;
|
||||
}
|
||||
.content .docblock > .impl-items > h4 {
|
||||
border-bottom: 0;
|
||||
}
|
||||
.content .docblock >.impl-items .table-display {
|
||||
margin: 0;
|
||||
}
|
||||
|
|
@ -688,7 +682,8 @@ a {
|
|||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.invisible > .srclink, h4 > code + .srclink, h3 > code + .srclink {
|
||||
.invisible > .srclink,
|
||||
.method > code + .srclink {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
|
|
@ -923,7 +918,7 @@ body.blur > :not(#help) {
|
|||
flex-grow: 1;
|
||||
}
|
||||
|
||||
.impl-items h4, h4.impl, h3.impl, .methods h3 {
|
||||
.has-srclink {
|
||||
display: flex;
|
||||
flex-basis: 100%;
|
||||
font-size: 16px;
|
||||
|
|
@ -1134,6 +1129,13 @@ a.test-arrow:hover{
|
|||
margin: 0;
|
||||
}
|
||||
|
||||
.notable-traits .notable {
|
||||
margin: 0;
|
||||
margin-bottom: 13px;
|
||||
font-size: 19px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.notable-traits .docblock code.content{
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
|
|
@ -1197,12 +1199,6 @@ pre.rust {
|
|||
margin-left: 5px;
|
||||
}
|
||||
|
||||
h4 > .notable-traits {
|
||||
position: absolute;
|
||||
left: -44px;
|
||||
top: 2px;
|
||||
}
|
||||
|
||||
#all-types {
|
||||
text-align: center;
|
||||
border: 1px solid;
|
||||
|
|
@ -1316,14 +1312,6 @@ h4 > .notable-traits {
|
|||
border-top: 1px solid;
|
||||
}
|
||||
|
||||
|
||||
|
||||
h3.notable {
|
||||
margin: 0;
|
||||
margin-bottom: 13px;
|
||||
font-size: 19px;
|
||||
}
|
||||
|
||||
kbd {
|
||||
display: inline-block;
|
||||
padding: 3px 5px;
|
||||
|
|
@ -1615,10 +1603,6 @@ details.undocumented[open] > summary::before {
|
|||
padding: 0;
|
||||
}
|
||||
|
||||
.content h4 > .out-of-band {
|
||||
position: inherit;
|
||||
}
|
||||
|
||||
#search {
|
||||
margin-left: 0;
|
||||
}
|
||||
|
|
@ -1638,7 +1622,7 @@ details.undocumented[open] > summary::before {
|
|||
z-index: 1;
|
||||
}
|
||||
|
||||
h4 > .notable-traits {
|
||||
.notable-traits {
|
||||
position: absolute;
|
||||
left: -22px;
|
||||
top: 24px;
|
||||
|
|
|
|||
|
|
@ -10,8 +10,7 @@ body {
|
|||
color: #c5c5c5;
|
||||
}
|
||||
|
||||
h1, h2, h3:not(.impl):not(.method):not(.type):not(.tymethod),
|
||||
h4:not(.method):not(.type):not(.tymethod) {
|
||||
h1, h2, h3, h4 {
|
||||
color: white;
|
||||
}
|
||||
h1.fqn {
|
||||
|
|
@ -20,10 +19,10 @@ h1.fqn {
|
|||
h1.fqn a {
|
||||
color: #fff;
|
||||
}
|
||||
h2, h3:not(.impl):not(.method):not(.type):not(.tymethod) {
|
||||
h2, h3, h4 {
|
||||
border-bottom-color: #5c6773;
|
||||
}
|
||||
h4:not(.method):not(.type):not(.tymethod):not(.associatedconstant) {
|
||||
h4 {
|
||||
border: none;
|
||||
}
|
||||
|
||||
|
|
@ -407,6 +406,10 @@ pre.ignore:hover, .information:hover + pre.ignore {
|
|||
border-color: #5c6773;
|
||||
}
|
||||
|
||||
.notable-traits-tooltiptext .notable {
|
||||
border-bottom-color: #5c6773;
|
||||
}
|
||||
|
||||
#titles > button.selected {
|
||||
background-color: #141920 !important;
|
||||
border-bottom: 1px solid #ffb44c !important;
|
||||
|
|
|
|||
|
|
@ -3,15 +3,13 @@ body {
|
|||
color: #ddd;
|
||||
}
|
||||
|
||||
h1, h2, h3:not(.impl):not(.method):not(.type):not(.tymethod),
|
||||
h4:not(.method):not(.type):not(.tymethod) {
|
||||
h1, h2, h3, h4 {
|
||||
color: #ddd;
|
||||
}
|
||||
h1.fqn {
|
||||
border-bottom-color: #d2d2d2;
|
||||
}
|
||||
h2, h3:not(.impl):not(.method):not(.type):not(.tymethod),
|
||||
h4:not(.method):not(.type):not(.tymethod) {
|
||||
h2, h3, h4 {
|
||||
border-bottom-color: #d2d2d2;
|
||||
}
|
||||
|
||||
|
|
@ -356,6 +354,10 @@ pre.ignore:hover, .information:hover + pre.ignore {
|
|||
border-color: #777;
|
||||
}
|
||||
|
||||
.notable-traits-tooltiptext .notable {
|
||||
border-bottom-color: #d2d2d2;
|
||||
}
|
||||
|
||||
#titles > button:not(.selected) {
|
||||
background-color: #252525;
|
||||
border-top-color: #252525;
|
||||
|
|
|
|||
|
|
@ -5,15 +5,13 @@ body {
|
|||
color: black;
|
||||
}
|
||||
|
||||
h1, h2, h3:not(.impl):not(.method):not(.type):not(.tymethod),
|
||||
h4:not(.method):not(.type):not(.tymethod) {
|
||||
h1, h2, h3, h4 {
|
||||
color: black;
|
||||
}
|
||||
h1.fqn {
|
||||
border-bottom-color: #D5D5D5;
|
||||
}
|
||||
h2, h3:not(.impl):not(.method):not(.type):not(.tymethod),
|
||||
h4:not(.method):not(.type):not(.tymethod) {
|
||||
h2, h3, h4 {
|
||||
border-bottom-color: #DDDDDD;
|
||||
}
|
||||
|
||||
|
|
@ -348,6 +346,10 @@ pre.ignore:hover, .information:hover + pre.ignore {
|
|||
border-color: #999;
|
||||
}
|
||||
|
||||
.notable-traits-tooltiptext .notable {
|
||||
border-bottom-color: #DDDDDD;
|
||||
}
|
||||
|
||||
#titles > button:not(.selected) {
|
||||
background-color: #e6e6e6;
|
||||
border-top-color: #e6e6e6;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue