rustdoc: remove unused CSS class in-band

Since a7c25b2957 removed `in-band` from code
headers, the only remaining uses of the `in-band` class are:

02cd79afb8/src/librustdoc/html/render/write_shared.rs (L520-L521)

02cd79afb8/src/librustdoc/html/templates/print_item.html (L2-L3)

02cd79afb8/src/librustdoc/html/render/context.rs (L637-L638)

02cd79afb8/src/librustdoc/html/render/mod.rs (L368-L369)

02cd79afb8/src/librustdoc/html/render/mod.rs (L401-L402)

02cd79afb8/src/librustdoc/html/static/js/main.js (L525)

Since all of these uses are nested below `h1.fqn`, we can get rid of it,
and the support code that was used for when `in-band` was part of item
rendering.
This commit is contained in:
Michael Howell 2022-10-04 11:54:40 -07:00
parent c97d02cdb5
commit 3cb03cb342
16 changed files with 45 additions and 63 deletions

View file

@ -634,9 +634,7 @@ impl<'tcx> FormatRenderer<'tcx> for Context<'tcx> {
write!(
buf,
"<div class=\"main-heading\">\
<h1 class=\"fqn\">\
<span class=\"in-band\">Rustdoc settings</span>\
</h1>\
<h1 class=\"fqn\">Rustdoc settings</h1>\
<span class=\"out-of-band\">\
<a id=\"back\" href=\"javascript:void(0)\" onclick=\"history.back();\">\
Back\

View file

@ -364,11 +364,7 @@ impl AllTypes {
}
}
f.write_str(
"<h1 class=\"fqn\">\
<span class=\"in-band\">List of all items</span>\
</h1>",
);
f.write_str("<h1 class=\"fqn\">List of all items</h1>");
// Note: print_entries does not escape the title, because we know the current set of titles
// doesn't require escaping.
print_entries(f, &self.structs, ItemSection::Structs);
@ -398,9 +394,7 @@ fn scrape_examples_help(shared: &SharedContext<'_>) -> String {
let mut ids = IdMap::default();
format!(
"<div class=\"main-heading\">\
<h1 class=\"fqn\">\
<span class=\"in-band\">About scraped examples</span>\
</h1>\
<h1 class=\"fqn\">About scraped examples</h1>\
</div>\
<div>{}</div>",
Markdown {

View file

@ -517,9 +517,7 @@ if (typeof exports !== 'undefined') {exports.searchIndex = searchIndex};
};
let content = format!(
"<h1 class=\"fqn\">\
<span class=\"in-band\">List of all crates</span>\
</h1><ul class=\"all-items\">{}</ul>",
"<h1 class=\"fqn\">List of all crates</h1><ul class=\"all-items\">{}</ul>",
krates
.iter()
.map(|s| {

View file

@ -148,6 +148,13 @@ h1, h2, h3, h4 {
h1.fqn {
margin: 0;
padding: 0;
flex-grow: 1;
/* We use overflow-wrap: break-word for Safari, which doesn't recognize
`anywhere`: https://developer.mozilla.org/en-US/docs/Web/CSS/overflow-wrap */
overflow-wrap: break-word;
/* Then override it with `anywhere`, which is required to make non-Safari browsers break
more aggressively when we want them to. */
overflow-wrap: anywhere;
}
.main-heading {
display: flex;
@ -214,7 +221,7 @@ pre.rust a,
.sidebar h2 a,
.sidebar h3 a,
.mobile-topbar h2 a,
.in-band a,
h1.fqn a,
.search-results a,
.module-item .stab,
.import-item .stab,
@ -654,19 +661,6 @@ pre.example-line-numbers {
font-weight: normal;
}
.in-band {
flex-grow: 1;
margin: 0px;
padding: 0px;
/* We use overflow-wrap: break-word for Safari, which doesn't recognize
`anywhere`: https://developer.mozilla.org/en-US/docs/Web/CSS/overflow-wrap */
overflow-wrap: break-word;
/* Then override it with `anywhere`, which is required to make non-Safari browsers break
more aggressively when we want them to. */
overflow-wrap: anywhere;
background-color: var(--main-background-color);
}
.docblock code, .docblock-short code,
pre, .rustdoc.source .example-wrap {
background-color: var(--code-block-background-color);
@ -752,7 +746,7 @@ a {
display: initial;
}
.in-band:hover > .anchor, .impl:hover > .anchor, .method.trait-impl:hover > .anchor,
.impl:hover > .anchor, .method.trait-impl:hover > .anchor,
.type.trait-impl:hover > .anchor, .associatedconstant.trait-impl:hover > .anchor,
.associatedtype.trait-impl:hover > .anchor {
display: inline-block;

View file

@ -522,7 +522,7 @@ function loadCss(cssFileName) {
}
let currentNbImpls = implementors.getElementsByClassName("impl").length;
const traitName = document.querySelector("h1.fqn > .in-band > .trait").textContent;
const traitName = document.querySelector("h1.fqn > .trait").textContent;
const baseIdName = "impl-" + traitName + "-";
const libs = Object.getOwnPropertyNames(imp);
// We don't want to include impls from this JS file, when the HTML already has them.

View file

@ -1,18 +1,16 @@
<div class="main-heading"> {#- -#}
<h1 class="fqn"> {#- -#}
<span class="in-band"> {#- -#}
{{-typ-}}
{#- The breadcrumbs of the item path, like std::string -#}
{%- for component in path_components -%}
<a href="{{component.path|safe}}index.html">{{component.name}}</a>::<wbr>
{%- endfor -%}
<a class="{{item_type}}" href="#">{{name}}</a> {#- -#}
<button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"> {#- -#}
<img src="{{static_root_path|safe}}clipboard{{page.resource_suffix}}.svg" {# -#}
width="19" height="18" {# -#}
alt="Copy item path"> {#- -#}
</button> {#- -#}
</span> {#- -#}
{{-typ-}}
{#- The breadcrumbs of the item path, like std::string -#}
{%- for component in path_components -%}
<a href="{{component.path|safe}}index.html">{{component.name}}</a>::<wbr>
{%- endfor -%}
<a class="{{item_type}}" href="#">{{name}}</a> {#- -#}
<button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"> {#- -#}
<img src="{{static_root_path|safe}}clipboard{{page.resource_suffix}}.svg" {# -#}
width="19" height="18" {# -#}
alt="Copy item path"> {#- -#}
</button> {#- -#}
</h1> {#- -#}
<span class="out-of-band"> {#- -#}
{% if !stability_since_raw.is_empty() %}